โ11-21-2022 03:15 PM
Iโm trying to pass a String into a Salesforce SOQL query formula. The String is created in an Aggregate snap, which concatenates Ids from records that were queried from another system, and a Mapper. The mapper restructures the string to conform to SOQL requirements by replacing the pipes with commas, wrapping each item in single quotes, and adding parentheses. Below is the expression:
โ('โ+$IdString.replaceAll(โ|โ,โโ,โโ)+โ')โ
The String Literal looks perfect, but when the String is sent to Salesforce all the single quotes are escaped.
(โa022I00001Jm7uRQARโ,โa022I00001JmCJpQANโ,โa022I00001JmGqWQAVโ,โa022I00001KIIGGQA5โ,โa022I00001KIzjeQADโ,โa022I00001KJQWyQAPโ,โa022I00001KOnhYQATโ,โa022I00001KQzAcQALโ,โa022I00001KRTMeQAPโ,โa022I00001KRu4kQADโ)
gives the error:
โmessageโ:โ\nAND Id IN (\โa022I00001Jm7uRQAR\โ,\โa022I00001JmCJpQAN\โ\n ^\nERROR at Row:4:Column:11\nline 4:11 no viable alternative at character โ\โโ
How do I pass the formatted string to Salesforce without the quotes being escaped?
Solved! Go to Solution.
โ11-30-2022 12:16 PM
Answering my own question, there is a checkbox in the SOQL snap to escape single quotes from parameters. If this is unchecked, the single quotes will be passed to Salesforce as-is and are evaluated correctly.
โ11-30-2022 12:16 PM
Answering my own question, there is a checkbox in the SOQL snap to escape single quotes from parameters. If this is unchecked, the single quotes will be passed to Salesforce as-is and are evaluated correctly.