restrict approval if, requester is approver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 03:52 AM
Hi,
I have a requirement to restrict the user for approving the change request where user is also requester.
Have created BR (After) on change request,
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.addQuery('approver', <<caller>>);
gr.query();
if(gr.next())
{
current.setAbortAction(true);
gs.addInfoMessage('Caller approval restricted')
}
User should be restricted with every mode, i.e. via approval form, approve/reject button, list edit under related list on change record, inbound email action. Please suggest.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 03:58 AM
Hi Raj,
As per my understanding ,once approval generated then only we can have an interaction with sysapproval_approval table.. before you add any user as approver on change record, compare the adding user to currently login user. if both users same then restrict the user addition as an approver.
i think it would be easy, instead of playing with approver after generating it.
Thanks
Trinadh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 04:07 AM
Hi Raj,
You can create "If activity" in the workflow and place it before "Approval activity" with the script as. Modify it as per your req.
answer = ifScript();
function ifScript() {
if ( current.requester is part of the approval group ) {
return 'no';
}
else{
return 'yes';
}
}
Please mark helpful / Correct if your query is resolved
Rajesh kumar Annepaka