- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 09:35 PM
Hi Team,
Any Suggestion appreciated 🙂
I am working on an Integration from ServiceNow to a third party application. Integration is working fine successfully payload is received by thirdparty .
However when there is any special character in Short desc -"test: xxxxx\xx\xxx ". It is throwing error 502 IN response
I have configured the payload in Business Rule itself. Tried current.short_description.toString() didn't worked.
request.setRequestBody("{ \"_time\" : \"" + gdt.getNumericValue() + "\",\"number\" : \"" + current.number + "\" , \"dv_assignment_group\" : \"" + current.assignment_group.getDisplayValue() + "\" , \"dv_state\" : \"" + current.state.getDisplayValue() + "\", \"short_description\" : \"" + current.short_description + "\", \"dv_cmdb_ci\" : \"" + current.cmdb_ci.getDisplayValue() + "\", \"sys_created_on\" : \"" + current.sys_created_on + "\",\"origin\" : \"xyz\" ,\"dv_priority\" : \"" + current.priority.getDisplayValue() + "\" ,\"owner_name \" : \"" + current.caller_id.getDisplayValue() + "\", \"dv_service_offering\" : \"" + current.category.getDisplayValue() + "\" , \"dv_business_service\" : \"" + current.business_service.getDisplayValue() + "\",\"service_type\" : \"Incident\" ,\"sys_created_by\" : \"" + current.sys_created_by + "\", \"sys_updated_on\" : \"" + current.sys_updated_on + "\"}");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 10:48 PM
Hi @VR17 ,
Dealing with special character might create a problem.
Try using encoding the special character before adding it to JSON.
You can take help from URL Encoding Reference — ServiceNow Elite.
ServiceNow JavaScript escape characters - Support and Troubleshooting
Solved: How do I escape these characters in the Script Inc... - ServiceNow Community
Thanks and Regards,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 10:48 PM
Hi @VR17 ,
Dealing with special character might create a problem.
Try using encoding the special character before adding it to JSON.
You can take help from URL Encoding Reference — ServiceNow Elite.
ServiceNow JavaScript escape characters - Support and Troubleshooting
Solved: How do I escape these characters in the Script Inc... - ServiceNow Community
Thanks and Regards,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 02:43 AM
I have used this solution
var sd=current.short_description.replace(/[^A-Z0-9]/ig, "_");