Reference qualifiers to filter data of a reference field

Rufino
Giga Guru

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):

  1. var A - a lookup select box of states of location
  2. 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. 

3 REPLIES 3

Vedang1
Tera Expert

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.

Please mark it as solution proposed and helpful if its serves your purpose.

Thank you,
Vedang

Thanks for the answer @Vedang1!

I need to select more then one location. This will be possible using lookup select box?

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 

Please mark it as solution proposed and helpful if its serves your purpose.

Thank you,
Vedang