Custom CRM Integration Template Fails to Upload

Status
Not open for further replies.

bigtyre

Joined
May 17, 2018
Messages
4
Reaction score
1
I followed the instructions in https://www.3cx.com/docs/crm-integration/ to develop a simple server side custom CRM integration to connect to our contact management systems. When attempting to add it to 3CX I get an ArgumentNullException as shown below. It does add it to the list of integrations but even after restarting the 3CX services 'Show Template' always shows an empty template for that integration and selecting OK after picking my integration from the list reverts to None when the CRM integration page is opened again. I've attached the integration template with any private details omitted. The template produces results correctly when tested through the CRM Integration Editor.

The stack trace displayed is:
System.ArgumentNullException: Value cannot be null.
Parameter name: value
at System.Xml.Linq.XAttribute..ctor(XName name, Object value)
at CrmIntegration.CrmIntegrationRepository.ToXml(CrmIntegrationConfiguration crmIntegration)
at CrmIntegration.CrmIntegrationRepository.Save(CrmIntegrationConfiguration crmIntegration)
at ManagementConsoleJS.Controllers.CrmListController.UploadServerCrm(ILicenseService licenseService, ICollection`1 fileInput)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ManagementConsoleJS.Middleware.ExceptionWrapperMiddleware.d__3.MoveNext()
 

Attachments

  • Like
Reactions: Mykhailo
I just tested a completely blank template (created a new template, changed the name in the root element to TestTemplate and saved it) and it also fails with the same error.
 
Hi, I am facing the same kind of other issues as well.
I have generated xml template file with the help of software "3CX server side CRM template generator". Also, I have configured my developed REST apis to get contact detail by phone number.
It shows me below message everytime in 3CX portal > CRM Integration.
Message: "Your CRM integration is working but phone was not resolved to a contact. Please check log for undetected errors and warnings and try different phone"

It also shows "Result obtained".

But I have put debug pointer in my API and I am creating log file and writing to check. But it seems API calls does not take place from testing portion of CRM integration in 3CX settings.

Please help me on this.
 
Hello @bigtyre,

This is because your template is not specifying the Country. You need to add that attribute to the "Crm" element. Your Crm element looks like this:
Code:
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="BigTyre" Version="1">

And you need to add Country="US" for example, or any value you like:
Code:
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="BigTyre" Version="1" Country="US">

The Country attribute is not used at the moment, but it's mandatory. The error message should be more descriptive, we will improve that.

Please give it a try and let me know.

Kind regards.
 
  • Like
Reactions: Mykhailo
Hello @Nicunj Kabaria,

The message "Your CRM integration is working but phone was not resolved to a contact. Please check log for undetected errors and warnings and try different phone" means that 3CX managed to connect to the CRM, and the HTTP requests succeeded, however they didn't return any contact. You can check the response returned by your CRM in the logs tab.

Kind regards.
 
Hello @edossantos,

Thanks for your help. In addition to improving the error message, adding that Country is a required field to docs/server-side-crm-template-xml-description and docs/crm-integration would be helpful.

I'm having the same issue as @Nicunj Kabaria now. Where is the logs tab located that you mentioned in your response to them?
 
Where is the logs tab located that you mentioned in your response to them?

Nevermind, I found it under Activity Log on the dashboard.
 
I was referring to 3CX Console > Settings > CRM Integration > Server Side tab > Test button > Logs tab.

You can also check the CRM engine logs in file 3cxSystemService.log.
 
I have the similar issue, all the variables are set, and outputs are defined, however, it still says.

The message "Your CRM integration is working but phone was not resolved to a contact. Please check log for undetected errors and warnings and try different phone"

test log:

Code:
Started scenario with empty id
Request text: https://testserver.com/crm/api/v1/Contact/5b65955e7f4817cef
Response text: {"id":"5b65955e7f4817cef","name":"Demo Last","deleted":false,"salutationName":"Mr.","firstName":"Demo","lastName":"Last","accountId":"57e2c4efccc9eb223","title":"CEO","description":"Description long text","emailAddress":"[email protected]","phoneNumber":"0000000000","doNotCall":false,"addressStreet":"street","addressCity":"city","addressState":"state","addressCountry":"Australia","addressPostalCode":"1111","accountIsInactive":false,"accountType":"","createdAt":"2018-08-04 12:00:30","modifiedAt":"2018-08-04 15:48:30","emailAddressIsOptedOut":false,"emailAddressData":[{"emailAddress":"[email protected]","lower":"[email protected]","primary":true,"optOut":false,"invalid":false},{"emailAddress":"[email protected]","lower":"[email protected]","primary":false,"optOut":false,"invalid":false},{"emailAddress":"[email protected]","lower":"[email protected]","primary":false,"optOut":false,"invalid":false},{"emailAddress":"[email protected]","lower":"[email protected]","primary":false,"optOut":false,"invalid":false}],"phoneNumberData":[{"phoneNumber":"0000000000","primary":true,"type":"Mobile"},{"phoneNumber":"1111111111","primary":false,"type":"Office"},{"phoneNumber":"2222222222","primary":false,"type":"Home"},{"phoneNumber":"3333333333","primary":false,"type":"Fax"},{"phoneNumber":"4444444444","primary":false,"type":"Other"},{"phoneNumber":"0000000001","primary":false,"type":"Mobile"},{"phoneNumber":"1111111110","primary":false,"type":"Office"},{"phoneNumber":"2222222220","primary":false,"type":"Home"},{"phoneNumber":"5551234","primary":false,"type":"Other"}]}
Response finished
Variable fn set to Demo
Variable em set to [email protected]
Variable p set to 0000000000
Finished scenario with empty id
Result obtained

In the template, I did specify outputs..
HTML:
      <Outputs AllowEmpty="true">
        <Output Type="FirstName" Value="[fn]" />
        <Output Type="Email" Value="[em]" />
        <Output Type="PhoneMobile" Value="[p]" />
      </Outputs>
 
Last edited:
I think I have found the reason why. The output record has to contain the Incoming Number as one of the phone fields. If not, 3CX will deem that as invalid record and discard it. Since I'm using demo data, it's not matching.

please pay attention to ' - '

for example :
555-6666
vs
5556666

They are not treated as the same number when 3CX examine
<outputs> ---- Template determined API outputs
[Number] --- the query number (inbound Number)
 
Yes, you need to return the phone number you're searching for. And also, you need to provide the Output "ContactUrl", otherwise the contact will be inserted in 3CX Contacts but not considered a complete CRM contact, and a new search will be triggered for each inbound call, creating new contacts in 3CX Contacts with the same name...
 
Thank you for pointing out the ContactUrl, and it's better we add it in the documentation.
 
Thank you for pointing out the ContactUrl, and it's better we add it in the documentation.
Yes, we will be improving the documentation on this.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

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