How to make list collector variable dependent based on the selection from select box variable?

Alp Utku
Mega Sage

Hi all,

 

I got a catalog Item where I run data lookup policy. (from a customized table)

 

I do populate a list collector variable with relevant values at once based on the selection from a select box variables. 

 

It works fine but user asked me not to populate values at once. User wants to select multiple values manually.

 

I am attaching the screenshot to show the current behaviour. How can I stop values being populated at once?

 

Subdivision list collector values do get populated automatically based on the selections of functional line and division selections via data lookup policy. I do want values not to be populated automatically but selectable by user manually.

 

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Get rid of the data lookup policy, and/or whatever else you have in place to populate the value of the variable.  All you need to do in this case is change the reference qualifier on the list collector variable based on the value of the select box variable(s), and whatever the relationship is between that value and the list collector table.

 

As a simple example, I have a select box variable named v_group that has 3 choices with values that are the sys_id of the group.  My List Collector variable List table is the sys_user_grmember table.  I only want to be able to select group members (users) that belong to the group I selected, so my Reference qualifier and Variable attributes look like this:

BradBowman_0-1732128909472.png

this works because the group field on sys_user_grmember is a reference to the sys_user_group table, so its value is a sys_id.  The variable attribute ensures that the list filter is updated when the select box value changes.

 

 

View solution in original post

3 REPLIES 3

Brian Lancaster
Tera Sage

You can use a client script to set the filter in the list collector.

https://servicenowguru.com/client-scripts-scripting/changing-filter-list-collector-variable-client-s...

Brad Bowman
Kilo Patron
Kilo Patron

Get rid of the data lookup policy, and/or whatever else you have in place to populate the value of the variable.  All you need to do in this case is change the reference qualifier on the list collector variable based on the value of the select box variable(s), and whatever the relationship is between that value and the list collector table.

 

As a simple example, I have a select box variable named v_group that has 3 choices with values that are the sys_id of the group.  My List Collector variable List table is the sys_user_grmember table.  I only want to be able to select group members (users) that belong to the group I selected, so my Reference qualifier and Variable attributes look like this:

BradBowman_0-1732128909472.png

this works because the group field on sys_user_grmember is a reference to the sys_user_group table, so its value is a sys_id.  The variable attribute ensures that the list filter is updated when the select box value changes.

 

 

Thanks for your help Brad! This works like a charm!