Approval needs to be triggered to the manager of the approver if the approver and requestor are same

k_Mounika
Tera Contributor

Hi Team,

 

I have a requirement where 
Requestor should not be able to approve his own request. Approval workflow should trigger to the manager of the approver if the approver and requestor both are same person.


Thanks in Advance

3 REPLIES 3

Uncle Rob
Kilo Patron

How is the approver determined in the first place?

k_Mounika
Tera Contributor

Approver should be the requestor manager, but if the requestor is himself the approver approval should go to approver manager. Hope I am able to answer your question if there is anything else please let me know.
Also if it will be more helpful if you can elaborate your question

Thanks in Advance

Deepak Shaerma
Kilo Sage

Hi @k_Mounika 
Use a “Condition” check to determine if the approver (current.approver) is the same as the requestor (current.opened_by).

use script:

 

var managerSysID;
if (current.opened_by == current.approver) {
    // Assuming 'opened_by' and 'approver' are user references
    var userGr = new GlideRecord('sys_user');
    if (userGr.get(current.opened_by)) {
        managerSysID = userGr.manager.toString(); // Get manager’s sys_id
    }
}

 

Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma