PhoneBook add new Entry as CMR via API

Status
Not open for further replies.

Stefano COrradini

Joined
Sep 21, 2018
Messages
4
Reaction score
0
Hi, i need to add a contact to phonebook via API an set its type to CRM. How can i do it?
 
Hello @Stefano COrradini,

You just need to add a tag to the phone book entry before saving it:
Code:
void UpdateCrmContact(PhoneBookEntry entry)
{
  entry.Tag = "[CRM][" + DateTime.UtcNow.ToString("yyyyMMddHHmmss") + "]";
  entry.Save();
}

Kind regards,
 
Thanks for your answer. Just another question: how can i find a contact by a specific attribute (eg: phonenumber) without cycle all contacts? I tried the "where" statement with no success...
 
Using the Call Control API you should first get the Tenant using:
Code:
PhoneSystem.Root.GetTenant()

And then use:
Code:
Tenant.FindContacts()
 
I need to find contact by CrmContactData. Is it possible? Thanks!
 
What do you mean by CrmContactData? You can use the FindContacts method to search using a phone number.
 
OK, you mean PhoneBookEntry.CrmContactData. No, the FindContacts method will not check that field. You would need to iterate them all...
 
Or, you can iterate all the contacts once, put the property you need in a Dictionary, and perform the lookup in that dictionary... Then update the dictionary every X minutes for example...
 
The problem is that can be multiple contacts with the same phone number. The attribute "CrmContactData" (in witch i wrote an URL containing a unique integer ID) is for me unique and represents a specific contact.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,474
Latest member
costionofrei