- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2020 03:02 AM
Hi Team,
I am a new user to Service Now, I have created a workflow to automatically set some fields from Incident Table upon approval. Now my concern is, is there a way to approve the incident record via REST API.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2020 11:25 PM
BR is already running on insert/update but if you still want to update then you can update by scripted REST API

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2020 03:12 AM
Hi,
it's quite complex to do cause you have to impersonate user through REST API, have a look to the below thread, martin chabarria posted an interesting solution, you should give a try:
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2020 03:54 AM
Hi Alberto,
I have a workflow created which I have attached, in this workflow there is a Approve user stage in which a System Administrator needs to approve or reject the Incident request so that the workflow will move forward (I want to do this step via REST API).
( I want to integrate serviceNow with my application in which a person should get all the approval requests and he should be able to either reject or approve the request from my app itself. Now I am able to get a list of all the requests by making a GET call to this endpoint.
https://dev75712.service-now.com/api/now/table/sysapproval_approver?sysparm_query=approver=6816f79cc...^state=requested )
From here, I want to either approve or reject via REST API only. I do not know what endpoint to use and the payload. I am using Service Now trail account, I do not if I am allowed to do this or not.
If I am logged in as a System Administrator in Service Now UI, then I am able to approve/reject the incident record request. I do not know how to do the same (approve/reject) using REST APIs.
Please do help me with this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2020 09:48 PM
Hi Sonia,
I did this in a past for similar kind of requirement hope this might help
Write after/async business rule:
var record = current.u_myApproval_data;
var user = current.u_user;
var action = current.u_action;
var app = new GlideRecord('sysapproval_approver');
app.get(record);
app .query();
while (app.next()){
if(user == app.approver){
var impersonateUser = gs.getSession().impersonate(user);
if(action == 0){ //mark as approved
app.state = 'approved';
app.update();
}
else if (action == 1){ //mark as rejected
app.state = 'rejected';
app.update();
}
}
}
Please mark correct and Helpful if it helps
Thanks & Regards
Himanshu Dubey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2020 10:01 PM
Hi Himanshu,
Can I update this business rule using UI or Via any API.. if so please help me with it. I am not running any script, I just need to invoke APIs using POSTMAN.