LouisDAmbrosio | 2022-12-08 13:47:35 UTC | #1
Hello,
I am encountering an issue with a data action. It is used to create a Salesforce case. We are passing customer input into the Salesforce case. It works except if the customer's input quotation marks. My assumption is that it is due to the Request body template format. { "Description": "$!{input.Description}", } I think because of the quotation marks already in the body template, that creates an error. Is there anyone that encountered this? and how to solve it?
Thank you, Louis
Jason_Mathison | 2022-12-08 14:36:56 UTC | #2
Hi Louis,
First thing to try is esc.jsonString
https://help.mypurecloud.com/articles/velocity-macros-data-actions/
--Jason
LouisDAmbrosio | 2022-12-08 18:59:00 UTC | #3
Hi @Jason_Mathison ,
Thank you for this. I have tried to update the body template accordingly, but I think that's not what I should do as it didn't work. Should it be the Body URL template that needs to be updated following the velocity documentation?
Jason_Mathison | 2022-12-08 19:42:21 UTC | #4
Please post an example of the input, your configuration, and the error that you are getting. That allows the rest of us to reproduce your issue and offer suggestions.
--Jason
LouisDAmbrosio | 2022-12-08 20:13:08 UTC | #5
An example of customer input that caused the error was: What does "dominant feature" mean?
When testing the data action, I used the input: "My name is Louis"
The error I got is: Resolve request body template: Processing the Request Body Template resulted in invalid JSON. Unexpected character ('"' (code 34)): was expecting comma to separate Object entries at [Source: (String)"{ "Origin": "Messenger", "CaseOriginReportingc": "Messenger", "Languagec": "English", "Loginc": "", "RecordTypeId" : "012a0000001RUnGAAW", "Status": "New", "InteractionGUIDc": "", "Description": "My name is Louis"", "InteractionURL__c": "https://apps.mypurecloud.com/directory/#/engage/admin/interactions/", "Subject": "Web Messenger" }"; line: 9, column: 35]
Jason_Mathison | 2022-12-19 15:17:02 UTC | #6
Setting my request body template to something like this seems to work for me:
{"Description" : "$esc.jsonString(${input.Description})" }
--Jason
LouisDAmbrosio | 2022-12-13 17:01:15 UTC | #7
@Jason_Mathison It looks like it works. Thank you so much.
system | 2023-01-13 17:01:19 UTC | #8
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 17570