servicenow integration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
HI @RekhaK
You can try encoding the data and then decode at receiving end. You can use below out of box methods.
Scope Encode Method Decode Method
| Global Scope | GlideStringUtil.base64Encode(string) | GlideStringUtil.base64Decode(encodedString) |
| Scoped Apps | gs.base64Encode(string) | gs.base64Decode(encodedString) |
Thanks,
Vishal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @RekhaK
Before sending the description using JSon validator , you can validate whether its having any invalid char
OR
You can try with this:
r.setStringParameterNoEscape('desc', jsonEncode(current.description + ''));
OR
Try the code as mentioned in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have tried above solution, but no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
so what manipulation you did before sending and which is not working?
share here
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
