- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 06:47 AM
Hi community,
I have the following field where the user can insert any character. For example:
Then, behind the scenes once the form is submitted, a script include makes a REST API call.
However, the double quotes that the user inserted make the integration fail.
The request body looks like this:
Any ideas on how to solve this??
Thank you in advance,
Smith.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 01:46 AM
use to \\ to escape
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 06:50 AM
Hi,
how are you setting the request body?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 06:53 AM
Hi,
if you are using variable substitution in rest message then you can use this method
setStringParameterNoEscape();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 06:59 AM
Hi,
First, I have something like this (where "vs_description" is the name of the field).
var description=String(variables.vs_description);
Then, as you said I am using the NoEscape method to substitute the "description" variable in the rest message:
wsObject.setStringParameterNoEscape("description", description);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 10:39 PM