Users should not be able to approve their own requests

nameisnani
Mega Sage

Hi Team ,

 

can anyone please help me here with my requirement .

 

if Requested for = approver then error message should come  or abort 

 

scirpt i have tried these many scripts 

nameisnani_2-1716869406808.png

 

not working , can any one please help me here , what was the issue here .

 

 

 

2 REPLIES 2

Community Alums
Not applicable

Hi @nameisnani ,

Condition: current.source_table  ==  'sc_req_item' && current.sysapproval.opened_by ==  current.approver


Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	
	current.approver = current.approver.manager;
	current.comments = 'Approver is also Requester - Moved to Manager';

})(current, previous);

 

It was modified from a BR that I've used to auto-approved if Requester is also Approver.

 

nameisnani
Mega Sage

Hi @Community Alums 

 

This is the condition 

 

If "Requested for "  and same requested for if member of the group approval of the same catalog then requested for user shouldn't be able approve the request instead it should abort with some error message. 

 

could you please provide me the script