You are viewing limited content. For full access, please sign in.

Question

Question

Forms and Helper Methods to Assign tasks

asked on March 19, 2020

Hi everyone!  Hopefully someone out there understands helper methods better than I do and can help me out.  

I essentially have a team with three roles; Auth Approver, Wire Setup, and Wire Approver.  Some members of the team may belong to all three roles

I also have a process with 3 steps.  Auth Approver, Wire Setup, and Wire Approver and the tasks are assigned using a dynamic filter.

The employee that approves the Auth Approver step, should not be able to approve at the other two steps Wire Setup and Wire Approver at bank.

The employee that approves at Wire Setup should also not be allowed to approve the last step, Wire approver at bank.  

 

This is the helper method I have.  It seems to work at not allowing the approver at the first step, approve the second step, but when it moves to the third step, anyone can approve again...

var ExcludeAuthApprover = team.excludeTaskLastSubmitters(11);
var ExcludeWiresetupatbank = team.excludeTaskLastSubmitters(7);
var WireApproveratBank = team.findMembersByRole('Wire Approver at Bank');
$result=$util.union(ExcludeAuthApprover,ExcludeWiresetupatbank,WireApproveratBank);

0 0

Answer

SELECTED ANSWER
replied on March 19, 2020

I don't think you want to be using $util.union - that will give you anyone that meets any criteria.

So if I have three team members: John, Jane, and Joe.

Say your first variable gives me John and Jane, your second variable gives me Jane and Joe, and your third variable gives me John and Joe - your result will still be all three of them, because all three of them meet at least one of the criteria.

Instead of $util.union, you might want to use $util.intersection, which returns just the people that are in each list you pass to it.  Or use $util.difference (which only allows two parameters) - this one excludes whoever is in the second value, from the first value.

If what you're trying to do is get the list of staff with the role, but exclude both of the prior submitters, it might be something like this:

var ExcludeAuthApprover = team.findTaskLastSubmitters(11);
var ExcludeWiresetupatbank = team.findTaskLastSubmitters(7);
var WireApproveratBank = team.findMembersByRole('Wire Approver at Bank');
var exclude1 = $util.difference(WireApproveratBank, ExcludeAuthApprover);
var exclude2 = $util.difference(WireApproveratBank, ExcludeWiresetupatbank);
$result=$util.intersection(exclude1, exclude2);

This is saying - get the individual who submitted step 11 and exclude them from the list of approvers - then get the individual who submitted step 7 and exclude them from the list of approvers - then take the individuals who are in both lists.

Please note that although I believe this will work, I didn't actually test it. wink

2 0
replied on March 19, 2020

Matthew Tingey you Rock!!! This is exactly what I was looking for and it works like a charm!  Thanks for the help!

1 0
replied on March 19, 2020

So glad to be of assistance.  Have a good day!

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.