CRM Integration Returns Multiple Contacts

Status
Not open for further replies.

DEVNETTS

Premier Customer
Joined
Jul 22, 2020
Messages
42
Reaction score
14
How does the v16 server side CRM Integration handle contact lookups that return multiple matching contacts? Is there a way to define a scenario in the CRM template to take a different action if multiple contacts are returned?
 
The first returned contact will be used in that case.
 
Is there a way for a 3CX integration "scenario" to determine that there is more than one returned contact? and use sub scenarios to take different actions. one sub scenario would be the standard contact URL, the other scenario would use a contact search result URL.

On a related note, we have an issue with multiple phone numbers. We have noticed that 3CX seems to validate the phone number in the returned JSON. I assume this is because of the phone number matching rule. We use Zendesk integration. unfortunately, the Zendesk API only returns the primary phone number. If the searched phone number assigned as a secondary phone number on a contact in Zendesk, the user is returned, however, only the primary phone number is returned. Therefore the user does not match and the contact URL is not launched.

Is there a way to have a 3CX integration scenario for a condition where valid results are returned but no phone number matches?

Alternatively, if I am able return multiple phone numbers as a JSON array ( "phone":[ "1234567890", "9991114444", "1112223333" ] ) will 3CX select the contact?
 
Is there a way for a 3CX integration "scenario" to determine that there is more than one returned contact? and use sub scenarios to take different actions. one sub scenario would be the standard contact URL, the other scenario would use a contact search result URL.
No, there is no way to know this for a single scenario. If you have multiple scenarios, for example one that performs the lookup on contacts, and another that performs the lookup on companies, then you have a variable to know if how many results have been obtained in previous lookups, but this doesn't work for results from the same scenario.

On a related note, we have an issue with multiple phone numbers. We have noticed that 3CX seems to validate the phone number in the returned JSON. I assume this is because of the phone number matching rule. We use Zendesk integration. unfortunately, the Zendesk API only returns the primary phone number. If the searched phone number assigned as a secondary phone number on a contact in Zendesk, the user is returned, however, only the primary phone number is returned. Therefore the user does not match and the contact URL is not launched.

Is there a way to have a 3CX integration scenario for a condition where valid results are returned but no phone number matches?

Alternatively, if I am able return multiple phone numbers as a JSON array ( "phone":[ "1234567890", "9991114444", "1112223333" ] ) will 3CX select the contact?
You can assign the number being searched to a phone output, and then the returned result will be considered. This is something we are doing with Zendesk, the fix will be available shortly. In this case we generate an output of type PhoneBusiness2 containing the number being searched:
XML:
        <Output Type="PhoneBusiness" Value="[Phone]" />
        <Output Type="PhoneBusiness2" Value="[Number]" />

As a result, the returned record will always be considered a match because it will contain the number being searched in PhoneBusiness2. When this is the primary phone, the same number will also be in PhoneBusiness, so the number will be in 2 fields in 3CX Contacts, but we think this is better than ignoring some records that are valid matches.
 
  • Like
Reactions: Evolute IT
Thank you for your response. I am glad to hear that the multiple phone number situation is being addressed. Do you know when an update To the Zendesk integration template will be available?

I would like to see some simple true false scenario chaining. A JSON return count would be very helpful. There are many situations where one phone number will resolve to multiple contacts. Having a conditional event based on 0 results(no error), 1 Contact returned, >1 return wold go a long way in making the integration much more flexible.

Thanks.
 
XML:
<Output Type="PhoneBusiness" Value="[Phone]" />
<Output Type="PhoneBusiness2" Value="[Number]" />
As a result, the returned record will always be considered a match because it will contain the number being searched in PhoneBusiness2. When this is the primary phone, the same number will also be in PhoneBusiness, so the number will be in 2 fields in 3CX Contacts, but we think this is better than ignoring some records that are valid matches.
Could it be possible to have that second output variable with a SkipIf? This way, if the number is the same as [Phone], it would not add it twice.

XML:
<Output Type="PhoneBusiness2" Value="[Number]" SkipIf="EQUAL([Number],[Phone])" />
Do you know when an update To the Zendesk integration template will be available?
You can simply copy the XML template to a new file, let's say "Zendesk2.xml" and add the line provided by @edossantos. It should work just the same until the update.

I would like to see some simple true false scenario chaining. A JSON return count would be very helpful. There are many situations where one phone number will resolve to multiple contacts. Having a conditional event based on 0 results(no error), 1 Contact returned, >1 return wold go a long way in making the integration much more flexible.
You can look at Salesforce or Zoho. They use chained scenarios for lookup and in the case of Zoho, call journaling as well.
 
Thanks. I will take a look. If I can count the total number of results returned I can choose to launch different URLs and use the skip to ensure only one chained scenario is executed.

As for the multiple phone numbers it is my understanding that the Zendesk API returns a single phone number as “phone”. To lookup additional phone numbers you can modify the call but it returns these results as alternate identities in a different data block in the JSON return. I was looking at adding my own intermediate service to make multiple Zendesk API calls and then construct my own JSON. return.
 
Thank you for your response. I am glad to hear that the multiple phone number situation is being addressed. Do you know when an update To the Zendesk integration template will be available?
With Update 7 final.

I would like to see some simple true false scenario chaining. A JSON return count would be very helpful. There are many situations where one phone number will resolve to multiple contacts. Having a conditional event based on 0 results(no error), 1 Contact returned, >1 return wold go a long way in making the integration much more flexible.
Unfortunately this is not possible at the moment. If you have some programming knowledge, you can create a web service that acts as a proxy, receives the lookup request from 3CX, and then performs the lookup on the CRM, returning a single contact with the URL you want. You would need to create a custom template for this.

Could it be possible to have that second output variable with a SkipIf? This way, if the number is the same as [Phone], it would not add it twice.
There is no SkipIf for the Output element. But you can use an IIf expression, for example:
[IIf([Phone]==[Number],&quot;&quot;,[Number])]

However that will not always work, because the number in the CRM might not be exactly the same, and just match the final part....

You can look at Salesforce or Zoho. They use chained scenarios for lookup and in the case of Zoho, call journaling as well.
This is true, we have chained scenarios, but these don't apply to what @DEVNETTS needs. The chained scenarios are executed after each matching record in the first scenario. They need a single scenario which can check how many records were found by the first scenario, and that is not possible.
 
Thank you for your comments and help. Now that Update 7 is out, I tried the updated Zendesk integration. While it helped some, it does not completely solve the issues. The primary issue is related to is taking action if there is more than one result returned. I see from the Salesforce template I believe that using this expression in a Scenario Skip if

Code:
[IIf([FoundRecordCount]>1,True,False)]

Would cause the Scenario to be skipped if more than one result was returned. Therefore no output would be populated for that Scenario.

Based on the Salesforce template, if I create multiple "Matching Scenario" each with the above skip, I could get two scenarios in the template, but only one would populate the output variables.

This should allow me to set the needed Zendesk URL.

Does this seem like it will work?
 
One additional question if this is possible is there a way to create a Scenario that does not query the API but simply returns a URL in the form

Code:
https://[Domain].zendesk.com/agent/search/1?type=user&q=*[Number]
 
Thank you for your comments and help. Now that Update 7 is out, I tried the updated Zendesk integration. While it helped some, it does not completely solve the issues. The primary issue is related to is taking action if there is more than one result returned. I see from the Salesforce template I believe that using this expression in a Scenario Skip if

Code:
[IIf([FoundRecordCount]>1,True,False)]

Would cause the Scenario to be skipped if more than one result was returned. Therefore no output would be populated for that Scenario.

Based on the Salesforce template, if I create multiple "Matching Scenario" each with the above skip, I could get two scenarios in the template, but only one would populate the output variables.

This should allow me to set the needed Zendesk URL.

Does this seem like it will work?
I'm not sure to understand what you want to avoid with this. But adding the SkipIf is useless for the case of Zendesk, because there is a single lookup scenario. The variable [FoundRecordCount] will have a value greater than 0 when a second scenario is executed, when the first scenario returned any record. In this case, as we have only 1 scenario, the variable will be always 0.

If a single scenario returns 2 records, the first returned record is passed on.

One additional question if this is possible is there a way to create a Scenario that does not query the API but simply returns a URL in the form

Code:
https://[Domain].zendesk.com/agent/search/1?type=user&q=*[Number]
The request must exist, but you can ignore the result and return always the same URL. However, please note that this will be the Contact URL for the contact added to the 3CX phonebook. Each URL must be unique. If a second contact calls from the same number, the contact record will be updated in 3CX, instead of adding a new contact with the new name...
 
Thank you for your response. I appreciate your help. My thought was to have two scenarios. The first is the standard scenario for Zendesk. If only one result is returned, then the normal process of launching the user ticket list URL is what we want the system to do. However, adding a second matching scenario and adding a "skip if" to the standard scenario, I can have 3CX skip the scenario if more than one result is returned. The second scenario would then execute because it would be skipped if only 1 result is returned. The second scenario would set the URL above, which is the search result of end-users with that phone number associated with them.

Caller's number matches a single Zendesk end-user ---> Set URL to end-user URL using standard scenario --- Only if a single result is returned.

A second matching scenario is added that will only run if the call Zendesk API returns more than one result. This scenario would set the URL to a Zendesk search URL instead of a specific end-user URL.

The idea is that the last matching scenario executed will set the URL.

Keep in mind I am not looking to use the call logging or new contact creation if I deploy this.

This would only work if 3CX executes multiple matching scenarios and executes them in sequence.

Does 3 CX execute multiple matching scenarios, and are they executed in sequence?

Am I completely missing how the process works?



On a related note, I think it would be a really great improvement if the 3CX client could prompt the user with a list of matching CRM results, allowing them to pick one. Other competitors have this functionality in their Zendesk integrations. If the server passed the 3CX client a simple list with minimal information or if 3CX could pass the user to a back end page on the 3CX server, that would, in turn, give them the list to choose from. In either case, once selected, the identity of the CRM contact (end-user) would be passed to the 3CX server, and the user would be sent to the CRM page.
 
Thank you for your response. I appreciate your help. My thought was to have two scenarios. The first is the standard scenario for Zendesk. If only one result is returned, then the normal process of launching the user ticket list URL is what we want the system to do. However, adding a second matching scenario and adding a "skip if" to the standard scenario, I can have 3CX skip the scenario if more than one result is returned. The second scenario would then execute because it would be skipped if only 1 result is returned. The second scenario would set the URL above, which is the search result of end-users with that phone number associated with them.

Caller's number matches a single Zendesk end-user ---> Set URL to end-user URL using standard scenario --- Only if a single result is returned.

A second matching scenario is added that will only run if the call Zendesk API returns more than one result. This scenario would set the URL to a Zendesk search URL instead of a specific end-user URL.

The idea is that the last matching scenario executed will set the URL.

Keep in mind I am not looking to use the call logging or new contact creation if I deploy this.

This would only work if 3CX executes multiple matching scenarios and executes them in sequence.

Does 3 CX execute multiple matching scenarios, and are they executed in sequence?

Am I completely missing how the process works?
This will not work, because the first record returned by the first scenario will be used, even if your second scenario returns a different record. That second record will be discarded.

On a related note, I think it would be a really great improvement if the 3CX client could prompt the user with a list of matching CRM results, allowing them to pick one. Other competitors have this functionality in their Zendesk integrations. If the server passed the 3CX client a simple list with minimal information or if 3CX could pass the user to a back end page on the 3CX server, that would, in turn, give them the list to choose from. In either case, once selected, the identity of the CRM contact (end-user) would be passed to the 3CX server, and the user would be sent to the CRM page.
Thanks for your suggestion, we're always improving our product, however I can't tell if this will be implemented.
 
It sounds like my best option is an intermediate web service if I only want to get the CRM to open a direct end-user URL for single responses and a different URL for multiple results. It will take some work, but it might be a workable temporary solution.

However, this won't help with call logging.

For my own knowledge, why does the Salesforce template have multiple match scenarios?

Thanks again.
 
It sounds like my best option is an intermediate web service if I only want to get the CRM to open a direct end-user URL for single responses and a different URL for multiple results. It will take some work, but it might be a workable temporary solution.
This is the only solution you have to achieve what you want.

However, this won't help with call logging.
Call Journaling will create the ticket for the matched contact. If your scenario is not returning a valid contact ID, then you will not be able to log the call.

For my own knowledge, why does the Salesforce template have multiple match scenarios?
Salesforce has different entities, and that's why we need different lookup scenarios. We do the lookup on contacts, then on leads and then on accounts (actually you can configure the order). But the REST API call is different for each entity, so we need different scenarios.
 
I don't like to show competitor screen shots but in this case, this seems to be the best way to show how the 3CX extension, web client, and windows client can could be improved to handle multiple match situations. Similarly the new contact creation could use a similar over lay to as if a new contact should be created leaving it up to the user. Both would be a greate feature request.

1608151707391.png

Since I can add to the Product feature requests in the Idea forum can someone put this suggestion up for peer thoughts?
 
Last edited:
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow