Change Request, Change Requested by not allowed to approve of the change.

AdamRich
Tera Expert

We are looking at a way for change management to automatically block the approval of a user if they are the requestor of a change, that way they cannot approve of their own change if they are in one of the review groups.

 

What is the best practice for this?

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@AdamRich Create a business rule on Approval[sysapproval_approvar] table as follows.

 

Screenshot 2024-03-13 at 9.55.21 PM.png

Screenshot 2024-03-13 at 10.46.26 PM.pngScreenshot 2024-03-13 at 10.46.12 PM.png

Screenshot 2024-03-13 at 10.46.32 PM.png

Hope this helps.

View solution in original post

3 REPLIES 3

Sumanth16
Kilo Patron

Hi @AdamRich ,

 

1. Navigate to System Definition > Business Rules.
2. Click on New to create a new business rule.
3. Give the business rule a name, such as "Prevent Self Approval".
4. In the 'When to run' section, select 'before' and 'insert, update'.
5. In the 'Table' field, select 'Change Request [change_request]'.
6. In the 'Advanced' tab, write a script to check if the approver is the same as the change raiser. Here is a sample script:

(function executeRule(current, previous /*null when async*/) {
if (current.requested_by == current.approver) {
gs.addErrorMessage('You cannot approve your own change request.');
current.setAbortAction(true);
}
})(current, previous);


7. Click on Submit to save the business rule

 

This script will prevent the change request from being saved if the approver is the same as the person who requested the change. The 'gs.addErrorMessage' function displays a message to the user, and 'current.setAbortAction(true)' cancels the save operation.

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

Dr Atul G- LNG
Tera Patron
Tera Patron

Simply provided by @Sumanth16 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Sandeep Rajput
Tera Patron
Tera Patron

@AdamRich Create a business rule on Approval[sysapproval_approvar] table as follows.

 

Screenshot 2024-03-13 at 9.55.21 PM.png

Screenshot 2024-03-13 at 10.46.26 PM.pngScreenshot 2024-03-13 at 10.46.12 PM.png

Screenshot 2024-03-13 at 10.46.32 PM.png

Hope this helps.