servicenow integration

RekhaK
Tera Contributor

we are setting up the final description which is a combination of multiple things ok
so this we are setting up in the description of the JSON body that we are sending for creating demand via post call

now the issue is json will only take the valid character so if user put some line break or any addition invalid character .it will threw an error .so if i will use regex so i cant use that because in the post call directly i can write code while setting up the JSON body and if there is a way to write also so how many character i have to remove .that is also a big issue
tell me how to do that

5 REPLIES 5

JSON payload failing in Custom Action due to unescaped characters in multi‑line description

Description: We are generating a final description field by combining multiple catalog values and flow variables. This combined text is then inserted into the description field of the JSON payload used in our POST call to create a Demand record.

The issue is that JSON only accepts valid, properly escaped characters. If an end user enters line breaks, bullet points, or any other special characters in the catalog description, the resulting JSON body becomes invalid and the POST call fails. Since the Custom Action REST step only supports Text mode, we cannot apply regex or any server‑side escaping directly inside the JSON body. Even if regex were allowed, we cannot reliably predict how many characters or which specific characters users may enter, making manual cleanup impractical and error‑prone.

We need a supported mechanism to safely sanitize or escape multi‑line user input before it is inserted into the JSON body, so that the Demand creation API can accept the payload without failure.