IIf operator CRM Template

Status
Not open for further replies.

platinum

Silver Partner
Advanced Certified
Joined
Jan 24, 2020
Messages
16
Reaction score
2
According to the CRM template XML description, the operator [IIf(cond,res1,res2)] should be valid.
Now when i try to add the following into my CRM template
<Output Type="FirstName" Passes="0" Value=[IIf("[FirstName]"=="", null, "[FirstName]")]/>
i get "Server Error: Invalid XML File" thrown at me.
Since i'm still not that comfortable with XML proccessing, i also tried
<Output Type="FirstName" Passes="0" Value="[IIf("[FirstName]"=="", null, [FirstName])]"/>
and
<Output Type="FirstName" Passes="0" Value="[IIf("[FirstName]"=="", null, "[FirstName]")]"/>
same error, nice try.

I want to use this since the response mostly only contain partial information and my understanding is, that if there is missing information it will make another request on the next call and create a new contact too. This fills up your contacts with usless double entrys real quick. Source to this.

I guess I'm using it incorrectly, but can't seem to figure it out.
Any help is appreciated.

Kind Regards
 
There are 2 issues in your expression:
1) Variables don't need the quotation marks. If the variable is a string, then it is already considered a string, no need to add the quotes.
2) You need to escape the quotes in order to make the file a valid XML. The quotes are a special character in XML.

Also, you can't return null, you should use an empty string instead, but that wouldn't make sense because it's the value that already has the variable. So probably you will want to select between 2 variables, depending on if the first is an empty string or not. Something like this:
<Output Type="FirstName" Value="[IIf([FirstName]==&quot;&quot;,[LastName],[FirstName])]" />
 
There are 2 issues in your expression:
1) Variables don't need the quotation marks. If the variable is a string, then it is already considered a string, no need to add the quotes.
2) You need to escape the quotes in order to make the file a valid XML. The quotes are a special character in XML.

Also, you can't return null, you should use an empty string instead, but that wouldn't make sense because it's the value that already has the variable. So probably you will want to select between 2 variables, depending on if the first is an empty string or not. Something like this:
<Output Type="FirstName" Value="[IIf([FirstName]==&quot;&quot;,[LastName],[FirstName])]" />

Thanks for your help, i appreciate it. Your solution works as intendend.

One Problem still persists though:
Someone calls and they get added as CRM contact, they call again and a new contact is created this just goes on and on. I set the setting that it only looks up numbers that aren't in the 3CX phone book.
What requiremnts have to be met that the CRM integration won't constantly look up already added contacts?



Kind Regards
 
One Problem still persists though:
Someone calls and they get added as CRM contact, they call again and a new contact is created this just goes on and on. I set the setting that it only looks up numbers that aren't in the 3CX phone book.
What requiremnts have to be met that the CRM integration won't constantly look up already added contacts?
This is probably because your XML template is not returning the ContactUrl output during contact lookup. This is considered the primary key, so if the template doesn't return it, it will not be possible to update the contact in the next call. The ContactUrl should be unique for each contact, and always the same for the same contact.
 
Status
Not open for further replies.

Forum statistics

Threads
112,326
Messages
591,899
Members
165,479
Latest member
Senergia