How to parse double quotes in Jain.stringify

pavan patil
Tera Contributor

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, ' ');

 

20 REPLIES 20

Hi @Bhimashankar H , 

I tried with the above code , but it’s not working. It is giving me as http 400 I think because of regex . Can I get the different regex in order to accept the double quotes 

@pavan patil ,

 

There is no regex in above shared code. Maybe you are changing this code.

Use this code as is and Test once on HTTP method.

 

Only thig I can suggest is that whenever it is sending it should be sent like

{

"short_description":"Short Description by \"web\" service"

}

 

Check in logs what request body it is trying to send.

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

Hey @pavan patil ,

 

did you get a chance to verify the steps, did it send the correct JSON body?

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

@pavan patil 

did you try the 2nd link I gave?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

I tried this , it’s not working