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.

Saviynt integration is not working

chandan2212
Tera Contributor

Hi all , 

 

This script is not working fine and the output response  response and status is not showing :

 

gs.info('test_1234'+httpStatus in the logs is not coming anything

 

(function execute(inputs, outputs) {
    var phonenumber = inputs.phonenumber;
    var workphone = inputs.workphone;
    var accountname = inputs.accountname;

    try {
        var r = new sn_ws.RESTMessageV2('Saviynt rest message', 'post message');

        // If you're using parameters in the REST message body template
        r.setStringParameterNoEscape('phonenumber', phonenumber);
        r.setStringParameterNoEscape('workphone', workphone);
        r.setStringParameterNoEscape('username', accountname);

        // Alternatively, if you're building the body manually:
        // var requestBody = JSON.stringify({
        //     "phonenumber": phonenumber,
        //     "workphone": workphone
        // });
        // r.setRequestBody(requestBody);

        var response = r.execute();
        var responseBody = response.getBody();
        var httpStatus = response.getStatusCode();

        // Optionally log or output the response
        outputs.responseBody = responseBody;
        outputs.httpStatus = httpStatus;
        outputs.responseBody=responseBody;
        gs.info('test_1234'+httpStatus);
    } catch (ex) {
        var message = ex.message;
        outputs.error = message;
    }
})(inputs, outputs);
 
chandan2212_0-1760425039282.png

 

 

Response body and error showing nill , Can you advise me how to solve the problem.

 

Thanks and Regards,

Chandan Patra 

0 REPLIES 0