Custom CRM Integration Template Fails to Upload

Discussion in 'CRM / Helpdesk / App Integration' started by bigtyre, Jul 12, 2018.

  1. bigtyre

    Joined:
    May 17, 2018
    Messages:
    4
    Likes Received:
    0
    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()
     

    Attached Files:

  2. bigtyre

    Joined:
    May 17, 2018
    Messages:
    4
    Likes Received:
    0
    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.
     
  3. Nicunj Kabaria

    Joined:
    Jul 6, 2018
    Messages:
    1
    Likes Received:
    0
    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.
     
  4. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,154
    Likes Received:
    87
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,154
    Likes Received:
    87
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. bigtyre

    Joined:
    May 17, 2018
    Messages:
    4
    Likes Received:
    0
    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?
     
  7. bigtyre

    Joined:
    May 17, 2018
    Messages:
    4
    Likes Received:
    0
    Nevermind, I found it under Activity Log on the dashboard.
     
  8. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,154
    Likes Received:
    87
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...