Reference qualifiers to filter data of a reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 07:40 AM
Hi Folks,
I have a table that stores location name and state of location. (table.png)
In my record producer, I have 2 fields (form.png):
- var A - a lookup select box of states of location
- var B - a list collector of locations that must depend of "var A" selected.
How can I make "var B" dependent of selected "var A"? I've been trying to use reference qualifiers, but I'm failing with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 07:58 AM - edited 09-18-2023 08:04 AM
Hi Rufino,
Your var B needs to be a lookup from the location table.
Use this reference qualifier:
javascript(:)'sys_id='+current.variables.varA (remove bracket)
As you are fetching value not from the display field, but a secondary field on the table, you will only be able to do this via a lookup select box (as you can specify the attribute) and not a list collector.
- In order to provide a list, you can try an onChange script on var A.
- This can perform a GlideAjax query via a script include on the location table, and return the values of the names as an array.
- Back in your client script, you can perform a for-loop to g_form.addOption('uf','<element of array>').
This will give you an artifical list of the same location names to be selected in your list collector.
Thank you,
Vedang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 10:04 AM
Thanks for the answer @Vedang1!
I need to select more then one location. This will be possible using lookup select box?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 12:06 AM
You won't be able to select more than one variable using a lookup select box.
You would then need to use the 2nd method I discussed where you call upon the script include to send you the list.
You can use this video for reference:
https://www.youtube.com/watch?v=zvSwzPRgAbw&ab_channel=ServiceNerd
Thank you,
Vedang