- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 08:11 AM
Enable provision to move change back to access from Authorized and cancel all requested approval.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 08:20 AM
HI @MK-p ,
You can follow below steps to do.
- Go to change model and add Authorized to Access.
- Now create on UI action on change request and use below code.
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();
}
current.state=-4;
current.update();
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 08:20 AM
HI @MK-p ,
You can follow below steps to do.
- Go to change model and add Authorized to Access.
- Now create on UI action on change request and use below code.
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();
}
current.state=-4;
current.update();
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------