Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate reference variable options based off another reference variable.

Mark OToole1980
Tera Contributor

Hope you can help.  I am building a catalog item and need 2 reference variable to link to each other.

 

Variable 1 Faculty which a lookup select box referenced to a custom faculty table.  

Variable 2 School also needs to be a lookup select box referencing the custom school table.

 

The custom school table has a parent field that links to the Faculty table.

 

So I need the school variable to only show the records in the school table that have a parent of the option chosen in the faculty variable.

 

I have posted a picture of the simple form so far. How do I achieve this?  many Thanks

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Mark OToole1980 Please update the reference qualifier of the school field as follows.

 

Screenshot 2024-02-29 at 4.33.22 PM.png

View solution in original post

11 REPLIES 11

Malte_K
Tera Expert

Hi Mark,

in the dependent variable record under tab "Type specification", try the following in the Reference qualifier field (optionally add more static encoded_query like active=true or something to the string): 

javascript: 'parent=' + current.variables.my_facility_var;

 Import: You have to the add the attribute "ref_qual_elements=my_facility_var", so the filter is dynamically recalculated. See here: https://docs.servicenow.com/bundle/washingtondc-servicenow-platform/page/product/service-catalog-mana...

Sandeep Rajput
Tera Patron
Tera Patron

@Mark OToole1980 Please update the reference qualifier of the school field as follows.

 

Screenshot 2024-02-29 at 4.33.22 PM.png

Hi Sandeep, I have tried this but not returning options.  I have posted the script as built with field in School table u_parent_faculty as is built in the table.