File

projects/congarevenuecloud/ecommerce/src/lib/modules/crm/services/contact.service.ts

Description

This service is a work in progress.

The contact service provides methods for interacting with the contacts the current user has access to.

Usage

Example :
import { ContactService, AObjectService} from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
constructor( private contactService: ContactService)
}
// or
export class MyService extends AObjectService {
private contactService: ContactService = this.injector.get(ContactService);
}

Extends

AObjectService

Index

Properties
Methods

Methods

createNewContact
createNewContact(contact: Contact)

This method can be used to create a new contact record on Conga platform.

Parameters :
Name Type Optional Description
contact Contact No

instance of contact record to be created.

Returns : Observable<string>

string observable representing the identifier of the contact record created.

Public getContact
getContact(objQueryParams: Object)

Gets the contact record based on first name, last name and email address passed.

Example:

Example :
import { ContactService, Contact } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
contact: Contact;
contact$: Observable<Contact>;

constructor(private contactService: ContactService){}

ngOnInit(){
this.contactService.getContact({ Name: 'ContactName', Email: 'ContactEmail' }).subscribe(c => this.contact = c);
// or
this.contact$ = this.contactService.getContact({ Name: 'ContactName', Email: 'ContactEmail' });
}
}
Parameters :
Name Type Optional Description
objQueryParams Object No

An object that contains contact record properties like FirstName, LastName, Email etc. with values as search criteria.

an observable containing the current contact record matching the search criteria.

Public getContactById
getContactById(Id: string)

The method fetches the contact based on given contact Id in parameter.

Parameters :
Name Type Optional Description
Id string No

string identifier of the contact record to be fetched.

An observable containing the Contact for a given contact Id.

Public getContactForUser
getContactForUser()

Gets the contact record for the current user. If the user is not logged in.

Example:

Example :
import { ContactService, Contact } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
contact: Contact;
contact$: Observable<Contact>;

constructor(private contactService: ContactService){}

ngOnInit(){
this.contactService.getContactForUser().subscribe(c => this.contact = c);
// or
this.contact$ = this.contactService.getContactForUser();
}
}

an Observable containing the current contact record

Public getMyContact
getMyContact()

Gets the contact record for the current user. If the user is not logged in, it will return a new contact instance.

Example:

Example :
import { ContactService, Contact } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
contact: Contact;
contact$: Observable<Contact>;

constructor(private contactService: ContactService){}

ngOnInit(){
this.contactService.getMyContact().subscribe(c => this.contact = c);
// or
this.contact$ = this.contactService.getMyContact();
}
}

an observable containing the current contact record.

Properties

type
Default value : Contact
Protected userService
Default value : this.injector.get(UserService)

results matching ""

    No results matching ""