- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 02:46 AM
It seems if a change is canceled that approvers still have an outstanding task to approve a job which approval is now no longer required.
I thought it would be a buisness rule, but that didnt seem to work.
can someone advise the best way that if a a change is canceled, we then change the state of all approvals to no longer required anc close all tasks related.
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 03:56 AM
Hi,
I created a UI Action on the request item table to find and cancel outstanding approvals which is a pretty similar thing to what you're doing.
I used an if(approval.next) cos the existing BRs take into account the other approvals and mark them as not required.... It does highlight how to update the approval record though.... looks like you're referring to client script functions setValue(X,Y) etc etc
approval.state = 'rejected';
approval.comments = "Cancelled by " + user;
approval.update();
Example Script
var user = gs.getUserDisplayName();
var approval = new GlideRecord('sysapproval_approver');
approval.addQuery('sysapproval', current.sys_id);
approval.addQuery('state', 'requested');
approval.query();
if(approval.next()){
approval.state = 'rejected';
approval.comments = "Cancelled by " + user;
approval.update();
gs.addInfoMessage("Request Item: " + current.number + " has been cancelled");
} else {
gs.addInfoMessage("Request Item: " + current.number + " cannot be cancelled as there are no active approvals");
}//end else
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 04:43 AM
yes, all approvals still outstanding on that change request should be set to "No Longer Required"