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

Question

Question

Business Process Form: Using multiple values from Checkbox field to assign tasks to multiple roles in a team

asked on November 4, 2020

HI,

I have a form where I created a checkbox field for locations. Each location has a designated user who will handle any incoming task for their office location. If the user who is submitting the form selects multiple locations, then there should be tasks assigned to the admins of each location selected.

I tried to create a filter and use the following parameters in it:

$result=team.findMembersByRole()

in the brackets I want to specify the checkbox field, but it forces to select one option only; however I need to choose all options that are selected by the user. Does anyone know how to achieve this, or are there any workarounds? Thank you.

 

Wissam

0 0

Answer

SELECTED ANSWER
replied on November 5, 2020

Maybe I was not clear enough, I meant the value can be get and yet need to be parsed for further use.

Here is an example to parse and get selected options:

$checkbox = $util.getValue('Checkbox')
//parse and get selected options
$selectedOptions = []
for (var key in $checkbox)
{
    if ($checkbox[key] == true)
    {
        $selectedOptions.push(key);
    }
}

$result = [];
for (i = 0; i < $selectedOptions.length; i++)
{
   $result = $result.concat(team.findMembersByRole($selectedOptions[i]));
}

Hope it helps

1 0

Replies

replied on November 5, 2020 Show version history

Hi Wissam,

The variable picker shows checkbox's single option, while it is valid syntax to retrieve checkbox value without option. 

I test with following code in team filter:

$test = $util.getValue('Checkbox')

The $test output is a json string:

{"@a_id":"32229","@type":"list","@fieldType":"checkbox","@m_id":"32911","@m_path":"32911","@otherChoice":"Other","_other_data":"","_other":false,"choice_1":false,"choice_2":false,"choice_3":false}

from where selected choices can be retrieved I suppose.

0 0
replied on November 5, 2020 Show version history

Hi Ziyan,

 

I tried your suggestion and tested the outcome. Here is what I did:

 

$SelectedAdmin=$util.getValue('CST_CoH_Location')

I got the following error:

Filter returned a script error: The task assignment filter did not return an array. [LFF6001-TeamFilterResultNotArray] [LFF6010-FilterReturnedScriptError]

0 0
SELECTED ANSWER
replied on November 5, 2020

Maybe I was not clear enough, I meant the value can be get and yet need to be parsed for further use.

Here is an example to parse and get selected options:

$checkbox = $util.getValue('Checkbox')
//parse and get selected options
$selectedOptions = []
for (var key in $checkbox)
{
    if ($checkbox[key] == true)
    {
        $selectedOptions.push(key);
    }
}

$result = [];
for (i = 0; i < $selectedOptions.length; i++)
{
   $result = $result.concat(team.findMembersByRole($selectedOptions[i]));
}

Hope it helps

1 0
replied on November 6, 2020

Hi Ziyan,

It works! Thanks for your help.

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

Sign in to reply to this post.