flow or workflow: dot walk user.manager until manager is member of certain group

Les1
Tera Guru

objective: in order to find the right approver, need to dot walk the requested_for.manager path until manager is a member of a particular group, and then use that manager for the approval.  i'm open to this being a script in workflow but it seems like i should be able to make a "is an exec" subflow and put into a catalog flow loop to check,  so that it is re-usable 

 

so i'm envisioning a catalog item flow:

flow start

do the following until approval user is an exec:

     dot walk requested_for.manager.manager

           subflow to check if the current manager is part of group Exec

set approver

<..do whatever other item flow stuff ..> 

flow end

 

can anyone lend insight though how to accomplish the dot walking up the manager chain, then input to the subflow to verify if part of group = exec?

1 ACCEPTED SOLUTION

Either one, but you'll need to account for the possibility that it returns undefined.

e.g., for a workflow activity you'd change the 4th line to

answer = FindApprover(user, group);

and delete the gs.info line.

If there's a fall-back for an approver not found you can do something like:

var approvalUser = FindApprover(user, group);

if (approvalUser) {
    answer = approvalUser;
}
else {
    answer = 'fall_back_user';
}

 

You can also turn it into a script include and call it from wherever you want 🙂

View solution in original post

6 REPLIES 6

Chris

with this great script, any ideas for handling the use case of if a Manager in that dot walk is Missing? 

(currently if the mgr is missing the whole workflow bypasses any approvals )   it also seems to bounce through the FindApprover script without finding the matching approver.

if user in the dotwalk is just inactive, it appears to still walk up the chain to find the matching approver, so i think i'm ok there.

i dont see anything in the script you provided that is filtering for only Active users though, unless its somethin builtin

@Chris Helming nevermind about the "is missing" use case, was able to get assistance in another thread and create a separate script for that use case which will simply deflect submission so dont need to handle that use case in the workflow!

 

again thanks so much for helping with the original post!