Outbound REST Integration

subashds6515
Tera Contributor

Hi, 

How to Integrate two ServiceNow instances using the REST Message GET method.

 

I have tried with the POST method the connection is good and the Record Data also passing but the reference field values are not populated.

 

Can anyone suggest the best method for this?

 

Thanks.

Subash

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @subashds6515 

 

https://youtu.be/xRqIr5YwAFs

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************
csa #ServiceNow #TechnoFuncational Disclaimer: These videos are from my training batch. These videos did not promote any ServiceNow Sales pitch or marketing. These videos are only for knowledge purposes & basic on my experience & Knowledge. Redistribution or copying of functionality is not ...

Sohail Khilji
Kilo Patron
Kilo Patron

Can you share the script ?


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi,

String field values are populated, Reference field values only not populating.

This is my Business rule.

(function executeRule(current, previous /*null when async*/ ) {

    try {
        var r = new sn_ws.RESTMessageV2('Integration - Stories', 'POST');
		r.setStringParameterNoEscape('number',current.number);
		r.setStringParameterNoEscape('theme',current.theme);
		r.setStringParameterNoEscape('epic',current.epic);
		r.setStringParameterNoEscape('acceptance_criteria',current.acceptance_criteria);
        r.setStringParameterNoEscape('short_description',current.short_description);
		r.setStringParameterNoEscape('description',current.description);

        //override authentication profile 
        //authentication type ='basic'/ 'oauth2'
        //r.setAuthenticationProfile(authentication type, profile name);

        //set a MID server name if one wants to run the message on MID
        //r.setMIDServer('MY_MID_SERVER');

        //if the message is configured to communicate through ECC queue, either
        //by setting a MID server or calling executeAsync, one needs to set skip_sensor
        //to true. Otherwise, one may get an intermittent error that the response body is null
        //r.setEccParameter('skip_sensor', true);

        var response = r.execute();
        var responseBody = response.getBody();
        var httpStatus = response.getStatusCode();
    } catch (ex) {
        var message = ex.message;
    }

})(current, previous);

 

Hi @subashds6515 

 

Try using .getDisplayValue() for reference fields.

 

Regards,

Amit