Flow Designer - Approval - If Manager no Approval required, if Not a Manager then requires Approval.

Mark Lanning
Tera Guru

With In Workflow Editor, we use this If Script below, to check if the Requested For is a manager, if they are then no Approval is Required, If Not a manager will ask for the Requested for Manager to Approve.

 

How can I do the same in Flow Designer?

 

    answer = ifScript();
    function ifScript() {
        var openid = current.opened_by.toString();
        var manid = current.request.requested_for.toString();
        var gr = new GlideRecord('sys_user');
        var grOR = gr.addQuery('manager', openid);
        grOR.addOrCondition('manager', manid);
        gr.query();
        if (gr.hasNext()) {
            return 'yes';
        }
    }