Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to call RestMessage from Include Script

AnishSasidharan
Mega Expert

Please let me know steps required for calling RESTMessage in business rule/ script include.

For example, i need to pass one parameter from business rule to RESTMessage.

so whether i need to create a parameter(without values) in REST function(post or put) ?

Many Thanks in Advance.

6 REPLIES 6

Hi Jacob,



Do you know to set encoding to RESTMessage()?


I'm working for a Thailand customer, when SMS sent out, if short_description is in Thai characters, it does not display properly, i tried the following 2 ways both does not work:


1. r.setXMLParameter('smsMsg',"P1 incident opened - "+current.short_description); //gave me "&#3619" in ams




2. // results is also not right.


r.setXMLParameter('smsMsg',"P1 incident opened - "+current.short_description);


r.addHeader("Content-Type", "charset=UTF-8");


Photo 14-5-15 16 59 16.png


Thank you,


Han Ying


Hi,


Me too facing the same issue. I have created one Processor and Script include. I need to get the Parameters in Processor and based on the parameter, in Script Include I need to Glide the RITMs and return it as json obj to the front end.


But the issue is, I am struggling to connect the script include and Processor. And also I am new to REST Message. So as per your above comment I had already created one RESTMessage. But for "get" function i am not getting the result.


In "REST endpoint" what value we should give ? Pls suggest me the syntax for the End-Point.




Thanks.