when the manager is requested the item then approval manager should be skip if not need approval

Abhimitrake
Tera Contributor
answer = ifScript();
var mgr = current.variables.requested_for;
var gr = new GlideRecord('sys_user');
gr.get(mgr.sys_id);
var ge = gr.manager.toString();
function ifScript() {
    if (ge == current.opened_by.toString()) {
        return 'yes';
    } else {
        return 'no';
    }
}
 
 
 
The script is working but reverse order, if the request opened by and requested by manager are different then skipping the approval, when requested by manager and  opened by same then moving forward  for approval
 
can anyone help me with this
1 REPLY 1

brianlan25
Kilo Patron

I'm not sure I understand you logic. You are looking at a variable and then getting the variables manager and trying to compare it to the opened by. That would always be no because the opened by could be the manager but if you are trying to compare it to who is listed as there manager. Are you trying to make it so that if the open by is the manager of the person it is being submitted for then you can skip the approval? Also are you using a variable for who the items is requested for?