How to dynamically show variable values based on values selected in list collector on catalog item

Rohith2
Tera Contributor

I have a requirement, based on values selected on list collector field, we want to show values in another list collector field on catalog form.

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

Whatever the relationship is between the two list tables, add a reference qualifier.  In this example I have a list collector variable on the sys_user_group table named v_groups.  I have another list collector variable on the sys_user_grmember table where I only want to see records for the groups I selected.  The Reference qualifier and Variable attributes look like this:

BradBowman_0-1732735612178.png

This works because the sys_user_grmember table has a field named 'group' that is a reference to the sys_user_group table, so my list of sys_ids from the v_groups list collector makes it a complete statement.  The ref_qual_elements attribute ensures that the list filter is updated when the groups variable value changes.

 

 

Najmuddin Mohd
Mega Sage

Hi @Rohith2 ,
I am taking the example of User and Location. User has a location field. 
So, the requirement can be to show users only of the selected locations.

NajmuddinMohd_0-1732738477053.png

From the above, there are three users from two locations.
On Selecting, America First two users should populate.
On selecting, Brasil also, along with First two, third one also should populate.

NajmuddinMohd_1-1732738839475.png

 

NajmuddinMohd_2-1732738873476.png

 

So, the Requested field is dependent on the location.
In the reference qualifier of Requested, Select Advance reference qualifier 
and add the below line.

 

NajmuddinMohd_4-1732739466677.png

 

 

 

 

javascript: 'location=' + current.variables.location_2.replace(',','^ORlocation=');

 

 

location_2 is the variable name on the Catalog item.
location is the field name referencing the location on the user table.

 



The above lines does the following, 

For example if you want to show Users with two locations, we use the following reference qualifier. *Hardcoding

location and sys_id.

 

 

 

 

javascript: 'location=1234567890^ORlocation=09876543f21'

 

 

 

 

 
But, here when we use list collector, we get an object of all the SysIDs with comma (,) separated.
So, Convert the object with comma (,) separated to a string and replace comma with '^ORfield_name', here location which is on the User table.


If the above information helps you, Kindly mark it as Helpful and Accept the solution.

Regards,
Najmuddin.