How do you prevent a User from Approving Own Request (i.e requested_for = Approver)

sdarity1
Tera Contributor

How do you prevent a User from Approving Own Request (i.e. requested_for = Approver).

6 REPLIES 6

sdarity1
Tera Contributor

Manager Creates a Request with requested_for = User that is later configured as a Delegate for the Manager. This would allow the User who is now a Delegate of the Manager the ability to Approve a Request that is requested_for the Delegate User.

Approver should not be allowed to Approve Request for Self.


Good Simple Solution that also takes care of restricting Approvals that are initated via an Inbound Mail Action for Reject and Approve.

The Condition on the Business Rule was Not Working. The method you were using to obtain the sys_class_name was returning 'undefined'. Had to make the following change to the Business Rule Condition to get it to work properly.

current.state.changes() && current.sysapproval.sys_class_name == "sc_request" && gs.getUserID() == current.sysapproval.requested_for

Thank You


CapaJC
ServiceNow Employee
ServiceNow Employee

Perhaps a short "before update" Business Rule on the Approval (sysapproval_approver) table. If the state of the approval changes, and the approval is for a Request, and the current user is the requested_for individual, abort the update.

Condition:



current.state.changes() && current.sysapproval.getRecordClassName() == "sc_request" && gs.getUserID() == current.sysapproval.requested_for


Script:


current.setAbortAction(true);
gs.addErrorMessage("Nice try - sorry, Charlie");


after submitting BR state is approved