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

Kartik Choudha1
Tera Guru

Hey,

 

You need to achieve this through advance reference qualifier. I believe from advance ref-qualifier this requirement is achievable easily. 

 

User Override Reference qualifier of child table (pm_proejct_task) of parent table (task).

 

You'll get the pm_project_task table in related tab 'Dictionary Override'.

Correct you filter condition - Condition should be "OR" between type fields

 

To get you query, you can copy query by right click on breadcrumb(the one you have mentioned in screenshot) . and paste the same reference qualifier.

 

Note - As you have type condition, you can write if-else as well in reference qualifier.

 

Let me know about if any help needed in building this query. 

 

Have a below links handy to get knowledge on advance reference qualifier.

https://docs.servicenow.com/en-US/bundle/tokyo-platform-administration/page/script/server-scripting/...

 

https://www.servicenow.com/community/developer-forum/dynamic-advanced-reference-qualifier-examples/m...

 

 

Hope this helps!

 

Regards,

Kartik

AdvanceIfElseQuery.PNG

I wrote the if-else query in the Advanced Reference Qual and it didn't show me the groups as expected. It shows me the 'itil' type groups only. Whether I apply the '=' or 'LIKE' operators in the query, it is still giving me the same results. 

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

 

 

Thanks Kartik for your reply. 
Thank you for the information regarding the javascript&colon. This is my first time working on something like this. I will keep this in mind.

So I apply the script to the child table, pm_project_task, and the assignment group drop-down showed me the 'itil', 'Agile', and 'PPM Work Center' type. I checked whether I select 'PPM Agile Group' or 'PPM Work Center' option, the drop-down list remain the same. Should the PPM Group Type a reference field to the 'sys_user_group_type' table? Currently, it is a choice.
ProjectTaskOverridesRef.PNG

 

Here is the result of the drop-down:
AgileAnditil.PNG

 

Please advised, thank you.