The CreatorCon Call for Content is officially open! Get started here.

How to Display Different Groups Based on Selected Value?

YummyAmericano
Tera Contributor

Hello, 

I am having trouble setting up the logic for the Assignment Group in the Project Task form
I have created a custom field called 'PPM Group Type' with two options:
(PPM Agile Group) and (PPM Work Center).
ProjectTaskFormAssignmentGroup.PNG

I want the 'Assignment Group' to show all the Groups associate with the (Agile Team AND PPM Work Center) type when (PPM Agile Group) is selected.
Query: 
active=true^typeLIKEe350a0be2ff31110bd13a85df699b69b^typeLIKE1c5064fe2ff31110bd13a85df699b60b
ConditionsForPPMAgileGroup.PNG


I want the 'Assignment Group' to show all the Groups associate with the (PPM Work Center) type when (PPM Work Center) is selected. 
Query:
active=true^typeNOT LIKEe350a0be2ff31110bd13a85df699b69b^typeLIKE1c5064fe2ff31110bd13a85df699b60b
ConditionsForPPMWorkCenter.PNG


Currently, the 'Assignment Group' has a reference qual condition in place. 
ReferenceQualAssignmentGroup.PNG

Thank you for your help with this.

 
1 ACCEPTED SOLUTION

Hey ,

 

1. Whenever in reference qualifier if you write script first put javascript :  and then write the logic.

2. Kindly check in the dictionary override tab, the table is there or not on which you want this assignment group to to show records. We need to make changes in child table's reference qualifier and leave the parent table field (assignment_group) as it is.

 

e.g. - below assignment_group is on task table but i want to change reference qualifier on pm_project_task table which is child table of 'task' table.

KartikChoudha1_0-1672337529077.png

 

So, I'll do the change in child table (pm_project_task) of override reference qualifier.

 

KartikChoudha1_1-1672337600605.png

 

After javascript followed by colon sign , you can write your logic.

 

Hope this helps!

Kindly mark my responses helpful if it guides you to solutions or help you to understand.

 

Regards,

Kartik

 

 

View solution in original post

16 REPLIES 16

Hey,

Let me try to answer this:

"I want to understand one point, when I use the same filter with AND condition for TYPE field.

I don't get any records."

This could be you do not have a group that has two Group Type assigned. I have groups with two type (Agile and PPM Work Center). We use this group combinations solely for the PPM purposes. Technically I can create a new type to solve this two groups combination but I would like to keep only one Agile type in the system and that is why we use the two combinations type for a group.

Got it. Thanks.

Saurav Bhardwa2
Tera Contributor

Hello, 

You can create a Script Include in which you can filter out the groups and use it in a code as addEncodedQuery
Use script like this -
var array = [];
var getGroup = new GlideRecord('sys_user_group');
getGroup.addEncodedQuery('copy & paste the query');
getGroup.query();

while(getGroup.next()){
array.push(getGroup.getValue());
}
return array.toString();

},

 

Then use advanced Reference qualifier like this-:
javascript : 'sys_idIN' + new.ScriptlncludeName().ScriptIncludeFunction(current.variables.group);

How to use addEncodedQuery for two different query base on a selected value in the script you provided?

Query A if PPM Group Type = 'PPM Agile Group'

type=e350a0be2ff31110bd13a85df699b69b

Query B if PPM Group Type = 'PPM Work Center'

type=1c5064fe2ff31110bd13a85df699b60b


Please advised, thanks.

Try something like this 

addEncodedQuery("type=PPM Agile Group^type=PPM Work Center");