How to dynamically show variable values based on values selected in list collector on catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2024 11:10 AM
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.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2024 11:28 AM
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:
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2024 12:27 PM - edited ‎11-27-2024 12:33 PM
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.
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.
So, the Requested field is dependent on the location.
In the reference qualifier of Requested, Select Advance reference qualifier
and add the below line.
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.