Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

PrashantLearnIT
Giga Sage

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

1 Comment