Variable Set - Lookup Select Box - (client script onLoad issue)

Dazler
Mega Sage

Hi, I created a variable set used on 3 Catalog Item forms that has 3 lookup select box variables that pulls in the information from the Category, Subcategory, and Components from the Incident table.  I have been asked to autopopulate on 1 of the forms the category and subcategory with a default value. So in a client script I created an onLoad script that will populate those fields.

find_real_file.png

 

On the component field, the user will select the component that fits their request.

This is how my Type Specifications are set for the Component field.

find_real_file.png

 

And I have the variable attributes req_qual_elements set to subcategory

find_real_file.png

 

The problem is that when the form loads, it populates the category and subcategory fields as it should, but the component fields does not display the list based on the filter of that field.

find_real_file.png

 

If I manually change the subcategory field, then the list drops down.

find_real_file.png

 

Does anyone know what is causing this or how to fix it?  Would it be better to set these up using a script include?

1 ACCEPTED SOLUTION

No problem. I think the onLoad does not trigger the Advanced reference qualifier to recalculate.

You have 2 options:

  • Duplicate the variables and use the duplicates with default value for this form.

Or

  • Create a Script include that returns the Reference qualifier based on the subcategory.

View solution in original post

8 REPLIES 8

Willem
Giga Sage
Giga Sage

Can you add the Attribute ref_qual_elements to the variable and try again?

For example: ref_qual_elements=subcategory

find_real_file.png

 

ref_qual_elements field name list, separated by semicolons (";") any reference field with a reference_qual field Specifies a list of fields to be sent back to the server in order to get an updated reference.

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/reference-pages/conce...

Hi, I did add the ref_qual_elements=subcategory, but it still does not work.

 

find_real_file.png

You added this to the "How would you best categorize..." variable?

 

Instead of the onLoad client script, could you use the Default value on the "How would you best categorize..." variable to set that to Workday HR?

 

Sorry for the delay, but I can't use the default as not all the forms are using the same default value.