- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
You can include new line and special characters while sending values in REST API.
Simply use this function and get the value you want to send in request body
Example script:
function jsonEncode(str) {
str = new JSON().encode(str);
return str.substring(1, str.length - 1);
}
var r = new RESTMessage('TestIncidents', 'post');
r.setStringParameter("description", jsonEncode(current.description + ''));
var responser = r.execute();
If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL
Best Regards,
Prashant Kumar (LearnIT)
YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant
Blog LearnIT: https://medium.com/@LearnITbyPrashant
Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/
ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635
- 771 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.