Genesys CTI User Forum
Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: Dionysis on June 07, 2016, 04:42:39 PM
-
So here's a tricky problem.
I'm building an integration with Salesforce using IRD. Part of this is to use the "query" method of the SF API to return a specific account's details. Which involves querying based on a custom field containing a string value. So, I need to pass a value to the web service like this:
SELECT ID, Name FROM ACCOUNT WHERE Custom_Number__c = '99999999'
This works perfectly in SOAP UI. However when you attempt to do this in IRD, it fails, because IRD uses single quotes as it's delimiter. Huzzah!
I've found one article on the support site regarding the database action block which suggests how to fix this, but nothing regarding doing it for a web service call. The answer for the database block btw was "remove the quotes and it will work". However, SF can't handle the query without the single quotes. I've tried various iterations of concatenating variables, replacing punctuation with hex values, etc etc. Nothing has worked so far.
So... as far as I can see I have 2 options, find some weird URS magic that lets me escape the characters (backslash doesn't work btw) or build a custom web service to talk to the web service, which is not out of the question but isn't my favourite idea either.
Anyone found a way around this? Or got some idea of something I could try?
-
What about using ORS and Composer maybe?
-
I should have known that was coming. ;)
Not an option in this case as we do not have ORS for this customer. Plus there is the fact that I loathe composer, and don't have the time to write/debug raw scxml for this.
-
;D Yeah...I do remember an article about using variable and {s} as solution but can't find it nor remember the exact context...digging
-
If you using IRD database access object (Database Wizard) it usually takes care about quotes automatically - quotes are "removed" by IRD and reinserted back by URS when it execute this object.
If it is about generic usage of strings having quotes - such string need to be constructed dynamically.
x= StrFormat['SELECT ID, Name FROM ACCOUNT WHERE Custom_Number__c = ^s', '99999999'] -> x in runtime will have quotes inside. (^s insert string in place where it is used and takes it into quotes, ~s do the same but no quotes).
Also other string functions can be used and function Char[ascci1, ascii2, ...] returns string from provided ascii codes - Char[39] return sting from one char - quote.
Also it is possible to use in IRD Macro with context written as plain Java Script ( to create required strings for example)
-
Not a database object, I'm accessing the Salesforce SOAP web services so using the Web Services block. I'll give those options a try though, using plain javascript is an interesting prospect. :)
-
Tested using the ^s method and it worked first try, thanks terry!
-
Good.
Just in case in regards of JS - what is really supported is
Standard ECMA-262, 3rd Edition - December 1999
(with all URS functions in global scope)