Variable reference qualifier is not working in Variable editor

vamsi
Tera Contributor

Variable (Type: Lookup Selectbox ) Lookup Value from table having Reference Qualifier is not working on Variable editor.

i'm working on a requirement on Record Producer, The Requirement is as follows

User will fill some minimal data while submitting the record producer, once the record producer is submitted a custom table record will be created

The record created will have variables (which are hidden during form submission) those variables contains drop down values (Look up Select Box) populated from some tables.

Suppose just as an example consider the table below

TABLE: COUNTRIES& CITIES

CountryCity
USAWashington DC
USADALLAS
USAChicago
INDIAMUMBAI
INDIAHYDERABAD
INDIAPUNE
AUSTRALIASYDNEY
CANADATORONTO
CANADAOTTAWA

Variable1:

Name: country_1

Lookup From Table: COUNTRIES &CITIES

Lookup value Field: Country

Unique Values Only: True

Variable2:

Name: city_1

Lookup From Table: COUNTRIES &CITIES

Lookup value Field: City

Reference Qual: javascript:'u_country='current.variables.country_1

So the above configuration in Variable2 is populate the values based on country_1 variable on record producer

i.e. if country_1 field contains USA as selected value then city_1 field will only populate Washington DC, DALLAS, Chicago in drop down list.

This functionality is working good on Record Producer but the similar functionality is needed on Form's variable editor where if country_1 value is changed corresponding city_1 values should get populated. This is not working in Variable editor.

Any help is really appreciated.

Thanks,

Vamsi

1 ACCEPTED SOLUTION

vamsi
Tera Contributor

Hi,



I got the reason behind it


the reason is as follows:


Reference qualifiers in look up select box will not work on OnChange. We have to write OnChange catalog client script on Application variable and you can dynamically populate the options for Operation variable by querying the look up table.



Thanks,


Vamsi


View solution in original post

6 REPLIES 6

Anil Lande
Kilo Patron

Hi Vamsi,



As record producer and Form are two different things. you need to write same Client Script which you have written for record producer.


Scripts written for record producer form is limited to itself only, it wont be applied to record form.


you can find more on below links;


What is the difference between Record Producer and a Form to get record?


http://wiki.servicenow.com/index.php?title=Record_Producer



Thanks,


Anil Lande


Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Sanjeev Kumar1
Kilo Sage

Hi,



On form you need to write reference qualifier for Variable 2. and filter it based on   Country sys_id.


if you need I will send you code.


it is good if you create a include script and create a function for same in it.


and call function in reference qualifier.


for more detail see it.



Reference Qualifiers - ServiceNow Wiki


Hi Sanjeev,



Thanks for your reply,


I think i need to articulate the question much more clearly.


Yes i did the same, i have written reference qualifier and it is working as expected on Record Producer, but after submission of Record Producer on Ticket's Variable editor it is not replicating the same.



Thanks,


Vamsi


vamsi
Tera Contributor

Hi,



I got the reason behind it


the reason is as follows:


Reference qualifiers in look up select box will not work on OnChange. We have to write OnChange catalog client script on Application variable and you can dynamically populate the options for Operation variable by querying the look up table.



Thanks,


Vamsi