Contact not updating

Status
Not open for further replies.

Triple

Customer
Joined
Aug 5, 2020
Messages
32
Reaction score
5
So we've been running a successful CRM integration for several years based upon our own CRM integration app. Recently there was a change request to add the fields "businessphone2" and "phonemobile2"

After adding this to the CRM template and uploading it we've noticed that these fields never get populated. If we run the TEST we can see it's received but when we lookup the contact it's not updated. If we remove the contact and then make a test call the contact is added but again without the new fields. I think we are overlooking something but i cannot put my finger on it.

The CRM Template looks like this (some information has been altered due to privacy):

XML:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="NL" Name="MyCRM" Version="1" SupportsEmojis="false">
  <Number Prefix="AsIs" MaxLength="[MaxLength]" />
  <Connection MaxConcurrentRequests="15" />
  <Parameters>
    <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="True" />
    <Parameter Name="Subject" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Call Subject:" Default="3CX PhoneSystem Call" />
    <Parameter Name="InboundCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Answered Inbound Call:" Default="[DateTime]: Answered incoming call from [Number] to [Agent] ([Duration])" />
    <Parameter Name="MissedCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Missed Call:" Default="[DateTime]: Missed call from [Number] to [Agent]" />
    <Parameter Name="OutboundCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Answered Outbound Call:" Default="[DateTime]: Answered outgoing call from [Agent] to [Number] ([Duration])" />
    <Parameter Name="NotAnsweredOutboundCallText" Type="String" Parent="ReportCallEnabled" Editor="String" Title="Unanswered Outbound Call:" Default="[DateTime]: Unanswered outgoing call from [Agent] to [Number]" />
  </Parameters>
  <Authentication Type="No" />
  <Scenarios>
    <Scenario Id="" Type="REST">
      <Request SkipIf="" Url="http://IP:PORT/api/search?Phone=[Number]&amp;Direction=[CallDirection]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <Rules>
        <Rule Type="Any">id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="firstname">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="lastname">
          <Filter />
        </Variable>
        <Variable Name="CompanyName" Path="company">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="email">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="businessphone">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness2" Path="businessphone2">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="phonemobile">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile2" Path="phonemobile2">
          <Filter />
        </Variable>
        <Variable Name="ContactUrl" Path="url">
          <Filter />
        </Variable>
      </Variables>
      <Outputs Next="" AllowEmpty="false">
        <Output Type="ContactID" Passes="0" Value="[ContactID]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="LastName" Passes="0" Value="[LastName]" />
        <Output Type="CompanyName" Passes="0" Value="[CompanyName]" />
        <Output Type="Email" Passes="0" Value="[Email]" />
        <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]" />
        <Output Type="PhoneBusiness2" Passes="0" Value="[PhoneBusiness2]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
        <Output Type="ContactUrl" Passes="0" Value="[ContactUrl]" />
      </Outputs>
    </Scenario>
    <Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True" Url="http://IP:PORT/api/ReportCall" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="callstarttimelocal" Passes="1" Type="String">[CallStartTimeLocal]</Value>
          <Value Key="callendtimelocal" Passes="1" Type="String">[CallEndTimeLocal]</Value>
          <Value Key="phone" Passes="1" Type="String">[Number]</Value>
          <Value Key="agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="calltype" Passes="1" Type="String">[CallType]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="true" />
    </Scenario>
  </Scenarios>
</Crm>

And the TEST output looks like this (some information has been altered due to privacy):
JSON:
[
  {
    "UnparsedOutputs": {
      "ContactID": "4705_0",
      "FirstName": "Customer Fullname",
      "LastName": "Algemeen",
      "CompanyName": "MyCompany",
      "Email": "[email protected]",
      "PhoneBusiness": "+31612345678",
      "PhoneBusiness2": "*+31612345678",
      "PhoneMobile": "",
      "PhoneMobile2": "",
      "ContactUrl": "http://IP:PORT/api/show?ContactID=4705_0"
    },
    "FirstName": "Customer Fullname",
    "LastName": "Algemeen",
    "Email": "[email protected]",
    "ContactUrl": "http://IP:PORT/api/show?ContactID=4705_0",
    "CompanyName": "MyCompany",
    "PhotoUrl": null,
    "ContactType": 0,
    "PhoneBusiness": "+31612345678",
    "PhoneBusiness2": "*+31612345678",
    "PhoneHome": null,
    "PhoneHome2": null,
    "PhoneMobile": "",
    "PhoneMobile2": "",
    "PhoneOther": null,
    "FaxBusiness": null,
    "FaxHome": null,
    "Pager": null,
    "ContactRawData": null
  }
]


Code:
Started scenario with empty id
Request text: http://IP:PORT/api/search?Phone=345678&Direction=Inbound
Response text: {
  "id": "4705_0",
  "firstname": "Customer Fullname",
  "lastname": "Algemeen",
  "company": "MyCompany",
  "businessphone": "+31612345678",
  "businessphone2": "*+31612345678",
  "phonemobile": "",
  "phonemobile2": "",
  "email": "[email protected]",
  "url": "http://IP:PORT/api/show?ContactID=4705_0"
}
Response finished
Variable ContactID set to 4705_0
Variable FirstName set to Customer Fullname
Variable LastName set to Algemeen
Variable CompanyName set to MyCompany
Variable Email set to [email protected]
Variable PhoneBusiness set to +31612345678
Variable PhoneBusiness2 set to *+31612345678
Variable PhoneMobile set to
Variable PhoneMobile2 set to
Variable ContactUrl set to http://IP:PORT/api/show?ContactID=4705_0
Finished scenario with empty id
Result obtained
 
The problem is that you're synching this contact to the 3CX phonebook and in this case the created contact will not have the phonebusiness2 field set?
 
Oké, does that mean all fields must have a value in order to be processed?
 
No, 3CX will add to the contact the outputs you define. What I want to confirm is if the issue is with the contact in the phonebook? Or you're seeing the contact details in the phone dialer when you receive a call?
 
Ah, got it! The problem is with the contact in the phonebook. It isn't updated there. Also when i deleted the contact and then trigger the CRM lookup the contact is newly added but without the fields "businessphone2" and "phonemobile2"...
 
Weird, I tested this case here, and I can add PhoneBusiness2 to the contact without problems. I also tested setting a phone number with an asterisk as a prefix, just in case that could cause an issue, and it works well too. So most probably there is something in your setup. Are you sure that the real call is matching the appropriate contact? I see that you're setting the matching length to 6 digits, because the lookup only sends that. You can try changing this from the Management Console > Advanced > Contacts > Options > Match Exactly. This way you will send the full number for contact lookup.
 
  • Like
Reactions: Evolute IT
Alright found the fix... Empty fields were return so changing the output to allow empty values was the solution... :)

This:
XML:
<Outputs Next="" AllowEmpty="false">

Became this:
XML:
<Outputs Next="" AllowEmpty="true">
 
  • Like
Reactions: jed and autohaus
Status
Not open for further replies.

Forum statistics

Threads
112,322
Messages
591,887
Members
165,470
Latest member
Robert Lee