Phone number from our own CRM

Status
Not open for further replies.

Netzhirsch

Customer
Joined
Feb 25, 2020
Messages
4
Reaction score
0
Hello everybody,

I've created an XML file with the 3CX CRM Template Designer to get the names of the contacts from our CRM.
My XML document looks like this:
XML:
<?xml version="1.0"?>
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Country="DE" Name="Hirschbuero" Version="5">
  <Number Prefix="Zeros" MaxLength="[MaxLengthNumber]" />
  <Connection MaxConcurrentRequests="16" />
  <Parameters>
    <Parameter Name="UserName" Type="String" Parent="General Configuration" Editor="String" Title="Username:" />
    <Parameter Name="Password" Type="Password" Parent="General Configuration" Editor="String" Title="Password:" />
    <Parameter Name="MaxLengthNumber" Type="String" Parent="General Configuration" Editor="String" Title="Maximum number of digits to keep in the phone number:" Default="20" />
  </Parameters>
  <Authentication Type="Basic">
    <Value>[UserName]:[Password]</Value>
  </Authentication>
  <Scenarios>
    <Scenario Type="REST">
      <Request Url="https://[UserName]:[Password]@example.de/3cx/kontakt/suchen/[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <Rules>
        <Rule Type="Any">kontakt.id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="kontakt.id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="kontakt.vorname">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="kontakt.nachname">
          <Filter />
        </Variable>
        <Variable Name="CompanyName" Path="kontakt.firma">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="kontakt.email">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="kontakt.rufnummer">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness2" Path="kontakt.rufnummer_ansprechpartner">
          <Filter />
        </Variable>
        <Variable Name="ContactUrl" Path="kontakt.url">
          <Filter />
        </Variable>
      </Variables>
      <Outputs Next="" AllowEmpty="true">
        <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="ContactUrl" Passes="0" Value="[ContactUrl]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

The test is also apparently okay (I don't know what the hint in the yellow box is supposed to mean).
1582621420213.png

So now the question: what am I doing wrong, or where do I have to configure something else?
And am I correct in assuming that an entry for the CRM result is automatically created in my local 3CX system phone book? That would be desirable.

Many thanks for the help! :)
 
The problem is that your template is not returning the phone number being searched in any of the returned phone fields. You need to ensure that the phone number, the Contact URL and at least one of First Name, Last Name or Company Name, are returned. Otherwise the contact is discarded.
 
The problem is obviously the slash in the phone number. If I add a hyphen to the phone number in CRM, the contact is saved correctly. If I have a slash in the phone number (e.g. 0451/12 23 34), the contact is not saved. What can i do?
 
Seems to be an issue in the CRM... You should change your contacts to avoid using this slash.
 
The question is why 3CX cannot import contacts whose phone numbers contain a slash?
 
The question is why 3CX cannot import contacts whose phone numbers contain a slash?
I'm not sure about this, non-numeric characters should be removed, so that should not be a problem for 3CX... From the screenshot you sent, I see that you're not assigning the phone number to any variable, but I'm not sure if that's from the last test you did... Can you make a test from the 3CX Console > Settings > CRM Integration > Test button reproducing the issue with the slash, and send the contents of the Logs tab?
 
I've changed my CRM-Output and replaced all slashes with a hyphen. So I think it's a bug or encoding problem in 3CX.

Here's the output of a non-working example.

Search Result:
JSON:
[
  {
    "UnparsedOutputs": {
      "ContactID": "101",
      "FirstName": "",
      "LastName": "",
      "CompanyName": "Company GmbH",
      "PhoneMobile": "",
      "PhoneMobile2": "",
      "PhoneBusiness": "0451 / 12345-0",
      "PhoneBusiness2": "",
      "Email": "[email protected]",
      "FaxBusiness": "",
      "ContactUrl": "https://buero.example.de/kontakt/bearbeiten/101"
    },
    "FirstName": "",
    "LastName": "",
    "Email": "[email protected]",
    "ContactUrl": "https://buero.example.de/kontakt/bearbeiten/101",
    "CompanyName": "Company GmbH",
    "PhotoUrl": null,
    "ContactType": 0,
    "PhoneBusiness": "0451 / 12345-0",
    "PhoneBusiness2": "",
    "PhoneHome": null,
    "PhoneHome2": null,
    "PhoneMobile": "",
    "PhoneMobile2": "",
    "PhoneOther": null,
    "FaxBusiness": "",
    "FaxHome": null,
    "Pager": null
  }
]

CRM-Protocol:

Started scenario with empty id
Request text: https://user:[email protected]/3cx/kontakt/suchen/0451123450
Response text: {"kontakt":{"id":101,"vorname":"","nachname":"","firma":"Company GmbH","mobilnummer":"","mobilnummer2":"","rufnummer":"0451 / 12345-0","rufnummer_ansprechpartner":"","email":"[email protected]","url":"https:\/\/buero.example.de\/kontakt\/bearbeiten\/101"}}
Response finished
Variable ContactID set to 101
Variable FirstName set to
Variable LastName set to
Variable CompanyName set to Company GmbH
Variable Mobile set to
Variable Mobile2 set to
Variable PhoneBusiness set to 0451 / 12345-0
Variable PhoneBusiness2 set to
Variable BusinessFax set to
Variable Email set to [email protected]
Variable ContactUrl set to https://buero.example.de/kontakt/bearbeiten/101
Finished scenario with empty id
Result obtained

 
Status
Not open for further replies.

Forum statistics

Threads
112,325
Messages
591,898
Members
165,479
Latest member
Senergia