Reference Qualifier on Lookup Select Box Variable

Blair5
Tera Guru

I've been looking through the WIKI/community and it seems like there is a bug with reference qualifiers on Lookup Select box variables. Does anyone know if there is a work around besides making the field a reference variable?

I have 3 variables on a form -- each dependent on the last. The first is a lookup select box and I'd like the second to be a lookup select box with a reference qualifier because setting it as a reference variable gives the same information as the third variable. I've tried only showing the columns I want (with attributes), but it still shows too much.

Is there another angle I can take? Building the list with a script? I only want to show unique values. Any ideas/help would be greatly appreciated because I think I've exhausted all the options I can think of. Thanks!

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

Seems like we all have been trolled here Look up select supports reference qualifier but it's not simple as reference field..



Check the wiki page



http://wiki.servicenow.com/index.php?title=Variable_Types#Lookup_Select_Box



We need to use 'ref_qual_elements' attribute to get the updated reference working..


I am able to do the dynamic thing working after adding the attribute...



Sample demo:



Create 2 lookup select variable called 'located_at' and 'user' referring location and user table respectively.


Idea here is to display the user depending on the location selected...


In the user variable, define reference qual as javascript: 'location='+current.variables.located_at; and variable attribute as ref_qual_elements=located_at



This will make the variable to use the updated reference. Try this out and let me know if this works for you as well.



Note: I tried on Fuji instance.


View solution in original post

78 REPLIES 78

Do you want to see the dictionary of the table? I see I had the wrong field name in the ref qual.

 

On the catalog item, the variable "role_source" should match on "u_platform" -- which it does. When role_source is selected, the next look up select box is based off u_platform.

 

The next variable is role and the field it is looking at on the table is u_role_category (dependent on u_platform). I wrote a global business rule originally to get the result when I had it set as a reference variable. Should I utilize the function I created in the business rule? If so, how? I'm sorry if this is a very simple thing that I can't grasp

 

Just like the dependent variable attribute,here the attribute should use the previous variable name and not the column name of the table. Makes sense?


And what about the ref qual? This is what I have: javascript: 'role='+current.variables.role_source; but it isn't narrowing down the list of entries based role source.


Don't think you have the correct column names and variable names


Try


JavaScript:'columnname='+current.variables.dependentvariablename



Shouldn't that be



javascript: 'u_role='+current.variables.role_source;


No - still doesn't work



javascript: 'u_role_category='+current.variables.role_source;


ref_qual_elements=role_source



I may just got back to building the drop down with the client script -- it's not pretty but it works. Not sure how else to do this.