ACL for Change Request (sysapprover_approval)

rocktheboat
Giga Contributor

Hello,

I want to remove 'Delete' functionality for the Approvals for a change request, except for Admins.

Also, just want it specifically for change requests. I tried to go the ACL route, at the 'sysapproval_approver' table at 'delete' operation

with

answer = gs.hasRole('approval_admin');

but them I though it will also alter the Approval for other request types.

Any idea how to resolve it?

I was thinking just disable the 'Delete' buttons in the UI (highlighted in yellow)

find_real_file.png

But I am not sure the what exactly is it and how to disable it. If it is a UI Action/ Script??

And then finally disabling this button.

find_real_file.png

1 ACCEPTED SOLUTION

So this is what I ended up doing in the ACL for 'sysapproval_approver' , operation 'Delete'   in the script section.



The following code check if the request is a 'change_request' or not. If it is and the User who is trying to delete the Approval Request has to have an 'approval_admin' role to delete it. Alternatively, if the request type is anything other then 'change_request' it follows the usual serivenow approval deletion process.



Here is the ACL Code:



if (current.sysapproval.sys_class_name == 'change_request')


{


answer = gs.hasRole('approval_admin');


}


else


{


answer = gs.hasRole('approval_admin') || gs.hasRole('itil') || gs.hasRole('catalog') || isApprovalMine(current);


}


View solution in original post

6 REPLIES 6

Bryan Tay3
Mega Guru

hi Som,



ACL below should help:



answer = (gs.hasRole('approval_admin') && current.sysapproval.sys_class_name != 'change_request');


So this is what I ended up doing in the ACL for 'sysapproval_approver' , operation 'Delete'   in the script section.



The following code check if the request is a 'change_request' or not. If it is and the User who is trying to delete the Approval Request has to have an 'approval_admin' role to delete it. Alternatively, if the request type is anything other then 'change_request' it follows the usual serivenow approval deletion process.



Here is the ACL Code:



if (current.sysapproval.sys_class_name == 'change_request')


{


answer = gs.hasRole('approval_admin');


}


else


{


answer = gs.hasRole('approval_admin') || gs.hasRole('itil') || gs.hasRole('catalog') || isApprovalMine(current);


}