replace double quotes with "\ when sending REST message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 01:00 AM
i need to replace double quotes with "\ when sending REST message. but when used below replace method, the final output which user receives in email is coming as "Testing double quotes"
first in WF : i am setting sub value and using the below
"Testing double quotes"
please help me, as this issue is occuring when user is entering the subject value in the record with double quotes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 02:44 AM
that's correct.
It's the fault of external system since you are able to replace it before sending to them.
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-10-2025 04:38 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-10-2025 01:03 AM
to ensure double quotes are sent as it is, you can use setStringParameterNoEscape(), instead of using
setStringParameter()
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-10-2025 01:39 AM
Hi @abhilash5 ,
Can you verify the external system is trying to protect against XSS (cross-site scripting) attacks? It may causes to converting special characters.
Possible solution for this requirement is - you can try with following script:
Try to replace the double quotes with a character that is less likely to be encoded into HTML entities
var sub1 = sub.replace(/"/g, '%%quot%%');
and then:
sub1 = sub1.replace(/%%quot%%/g, '"');