" /> Escaping characters in IRD - Genesys CTI User Forum

Author Topic: Escaping characters in IRD  (Read 2983 times)

Offline Dionysis

  • Sr. Member
  • ****
  • Posts: 408
  • Karma: 8
Escaping characters in IRD
« on: June 07, 2016, 04:42:39 PM »
Advertisement
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?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Escaping characters in IRD
« Reply #1 on: June 07, 2016, 05:04:00 PM »
What about using ORS and Composer maybe?

Offline Dionysis

  • Sr. Member
  • ****
  • Posts: 408
  • Karma: 8
Re: Escaping characters in IRD
« Reply #2 on: June 07, 2016, 05:17:56 PM »
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.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Escaping characters in IRD
« Reply #3 on: June 07, 2016, 05:22:33 PM »
;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

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: Escaping characters in IRD
« Reply #4 on: June 07, 2016, 05:26:20 PM »
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) 


Offline Dionysis

  • Sr. Member
  • ****
  • Posts: 408
  • Karma: 8
Re: Escaping characters in IRD
« Reply #5 on: June 07, 2016, 05:36:08 PM »
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. :)


Offline Dionysis

  • Sr. Member
  • ****
  • Posts: 408
  • Karma: 8
Re: Escaping characters in IRD
« Reply #6 on: June 07, 2016, 05:45:56 PM »
Tested using the ^s method and it worked first try, thanks terry!






Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: Escaping characters in IRD
« Reply #7 on: June 07, 2016, 05:47:47 PM »
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)