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 fetch Incident modification activities from Service-now API

anuruddha banda
Kilo Contributor

I was able to get created Incidents from the Service-now table API. I want to know is there any endpoint available to fetch each incidents modifications activities after those modified by someone. 

1 ACCEPTED SOLUTION

Instead of using endPoint function you should create the REST MESSAGE and call In your script

var request = new sn_ws.RESTMessageV2('YourRestMsgName','Post');

Regards,

Suresh.

Regards,
Suresh.

View solution in original post

11 REPLIES 11

I updated the REST Message's Endpoint URL  as  " https://03w7-192-684-85-96.ngrok.io/api/info" which is listing on my running server. But when i calling the Business Role, My server didn't received any request from service-now. Is there any missing part which i do need to fix? 

 

Business Rule script

(function executeRule(current, previous /*null when async*/ ) {
    if (current.sys_updated_on.toString() != previous.sys_updated_on.toString()) {
        try {
            var r = new sn_ws.RESTMessageV2('Intigrate_with_another_server', 'Create_Incident');

            var data = {
                short_description: current.short_description.toString(),
                caller_id: current.caller_id.email.toString(),
                state: current.state.toString()
            };
            r.setRequestHeader("Accept", "application/json");
            r.setRequestHeader('Content-Type', 'application/json');
            r.setRequestBody(JSON.stringify(data));

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

Can you refer below link and it having other option how to use REST AND SOAP integrations.

https://www.learnnowlab.com/rest-integration/

Regards,

Suresh.

Regards,
Suresh.