- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 01:12 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 09:27 AM
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.
Suresh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 01:17 AM
Sure i will check it, Thanks 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 09:21 AM
As you mention REST Message and tested it. Also the script for the REST message. I include that script in business rules. I tried this with another service-now instance.
Work flow for the Business Rule script
When i create or update an incident of Instance-A, this business rule will run and send a POST request to instance-B to create a new incident same as which updated or created in instance-A.
01) By setting up my server endpoint to the request.setEndpoint() will i able to get modifications info.?
ex:
request.setEndpoint('https://mydomain/api/modifications');
Script
(function executeRule(current, previous /*null when async*/ ) {
if (current.sys_updated_on.toString() != previous.sys_updated_on.toString()) {
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://<instance>.service-now.com/api/now/table/incident');
request.setHttpMethod('POST');
var user = 'admin';
var password = '<password>';
var data = {
short_description: current.short_description.toString(),
caller_id: current.caller_id.email.toString(),
state: current.state.toString()
};
request.setBasicAuth(user, password);
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestBody(JSON.stringify(data));
var response = request.execute();
gs.log(response.getBody());
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 09:27 AM
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.
Suresh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 09:35 AM
I hope I cleared your all queries. Can you mark it as the correct answer and help to close the thread. It will help for future readers.
Regards,
Suresh.
Suresh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 09:42 AM
Sure!
Thank you for your support !!