I am trying to build an integration into Sage CRM which is require me to be able to search for both person and company records using a phone number. I can't see a clear way of doing this from the API reference. Can anyone advise how I would do this?
I am trying to build an integration into Sage CRM which is require me to be able to search for both person and company records using a phone number. I can't see a clear way of doing this from the API reference. Can anyone advise how I would do this?
Hi Joshwr
I agree that the documentation is not very clear.
http://{server}/sdata/{installName}j/sagecrm2/-/vperson?where=pers_phonenumber eq'00000'
http://{server}/sdata/{installName}j/sagecrm2/-/vcompany?where=comp_phonenumber eq'00000'
Kind Reg
Perfect thank you that worked!
I wonder if you can advise on another API question. I want to create a communication record for the person or company found from this phone number search. I think I know how to set the record field values, but am not sure how to tie it to the specific person or company. Do you know how I'd do that?
Hi Joshswr
I would have to have a go, but I am assuming you need to use Comm_Link table and use CmLi_Comm_CompanyId, CmLi_Comm_PersonId. If I am not mistaken, it links with the communication table on CmLi_Comm_CommunicationId = Comm_CommunicationId.
Kind Reg
Hi Josh,
This article should get you started with creating a communication.
https://communityhub.sage.com/sage-global-solutions/sage-crm/b/sage-crm-hints-tips-and-tricks/posts/creating-a-communication-of-type-task-using-the-rest-api
If you need any help let me know.
Just be mindful that may not return all of the phone numbers linked to the company or person
Thanks Sean, I did find this and attempted to follow it. It has kind of worked, but creating the link seems to have having some issues.
With my test code I've created a single communication, but it appears twice in search (one with the company/person, and one without). Clicking into either of them, however, does not show that it is linked to a company or person, nor does it appear under the communications tab of those entities.
This is the data being sent with the API calls:
Creating communication:
{
"comm_subject": "Test communication",
"comm_note": "Phone call",
"comm_organizer": 29
}
Creating Link:
{
"CmLi_Comm_UserId": 29,
"CmLi_Comm_CommunicationId": 269087,
"CmLi_Comm_PersonId": 116491,
"CmLi_Comm_CompanyId": 85112
}
Hi Joshswr
We tried on our end and encountered the same issue. Additionally, when we edit one of the entries and save, it disappears, even though the links remain missing on the other.
Hoping someone can assist us both.
Just looking at the comm_link table, it looks like the API call is creating two records in the table instead of one. One has the personid and companyid, and one doesn't. Unsure if there's anything that can be done about this or if it's a glitch in the API?
Morning Josh,
I'll have to give it a test on my dev system. We've stopped using SData API a while back and developed our own for Sage CRM.
What version of CRM are you running?
Hi joshSWR
I can replicate this.
The POST to the communication table also creates the comm_link record, but with no "CmLi_Comm_PersonId" or "CmLi_Comm_CompanyId" so no need to do another POST.
Just grab the comm_link record id by
https://baseurl/sdata/crmj/sagecrm2/-/comm_link?where=cmli_comm_communicationid eq ‘xxxx’
And then PATCH
https://baseurl/sdata/crmj/sagecrm2/-/comm_link('xxxx')
with
{
"CmLi_Comm_UserId": 29,
"CmLi_Comm_PersonId": 116491,
"CmLi_Comm_CompanyId": 85112
}
Many thanks for your help!
I believe this was our last hurdle before going live with the integration. Fingers crossed!
*Community Hub is the new name for Sage City