How to parse double quotes in Jain.stringify

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi, I’m facing an issue with a record producer that is configured as a catalog item on the Employee Center portal. The form has a Description field, which is a free-text field.
The problem occurs when we enter text that contains double quotes. For example, if the user enters something like "test" in the Description field and submits the form, the request fails, and the incident is not created in the target instance.
This setup is part of our e-bonding integration between two ServiceNow instances. Normally, when a request is submitted through the record producer in the source instance, it creates an incident in the target instance. However, the integration only fails when the Description field contains double quotes.
When the Description does not include double quotes, the incident is created successfully in the other instance.
Could you please help me with this issue?
we are using the code in our script include :
JSON.stringify.replace(/“/g, ' ');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Make sure that replace is not used for any other field in your script.
Try logging the info that you are sending to REST, and check if the encoded is correctly happening.
Log the data that you are sending and take that data validate the JSON, share any error that your are geting for other source.
The data should encode something like
He said "hello" → "description": "He said \"hello\"".
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
you can escape the double quotes.
how are you sending data to other instance?
Is it via REST Message?
Share that script and screenshots.
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
4 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
share that complete script here
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
are you using variable substitution to set the description and pass via REST Message?
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