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

Question

Question

assign team role based on form variable

asked on June 9, 2017

We have a team with 3 roles, one role for each "location". The user task is assigned to the team with a filter to choose the correct role, or "location", for approval. Is there a way to assign to a role based on that variable? For example:

Form field variable options: LOC1, LOC2, LOC3

Team Roles: Approve1, Approve2, Approve3

var location=$util.getValue('facility');

if (location= 'LOC1')
$result =team.findMembersByRole('Approve1');
else
if (facility='LOC2')
$result =team.findMembersByRole('Approve2');
else
$result =team.findMembersByRole('Approve3');

0 0

Answer

SELECTED ANSWER
replied on June 9, 2017 Show version history

It sounds like you might want to:

  1. Create a hidden field to store the associated "role" name
  2. Add a change event to the "LOC" selection field that populates the hidden role field
    • Use essentially the same logic as in your example, just do it within the form. Maybe use a switch instead of if statements.
    • Make sure to trigger the "change" event on your role field after populating it
  3. Use that variable in the filter 
    • $result=team.findMembersByRole({/dataset/role_variable});

 

Scratch that. I tested it and it looks like you can indeed do that completely within the filter, and you were already pretty close with your example (I used a switch instead, but it should work either way).

switch($util.getValue('location_field')){
    case 'LOC1':
        $result = team.findMembersByRole('Approve1');
    break;
    case 'LOC2':
        $result = team.findMembersByRole('Approve2');
    break;
    case 'LOC3':
        $result = team.findMembersByRole('Approve3');
    break;
}

 

2 0
replied on June 12, 2017

That worked perfectly - Thank you!!!!

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.