How to create two dependent user fields on a record producer?

peterraeves
Mega Guru

What I am trying to do is to have two dependent user reference fields on a record producer. If one user is selected, I want the second list to be filtered on field X of the user, to only show users with the same value in X.

I know this article exists http://wiki.servicenow.com/index.php?title=Adding_Dependent_Variables#gsc.tab=0 , but it is outdated and has not been updated since october 2015. Therefore, I was wondering if someone had a better solution? Also, I'm referencing the User table, so I might not want to retrieve all records all at once.

1 ACCEPTED SOLUTION

Nate23
Mega Guru

if you have some type of reference/ lookup select box/list collector that you are trying to make dependent then try looking at the attribute ref_qual_elements.



you would add this to the attribute of the dependent variable like ref_qual_elements=depends_on_variables1,depeneds_on_var2



This tells the server to go fetch an updated query... you can use g_form.clearValue('var_name'); when a dependent var changes so old values dont stick.


View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Peter,



If the field is a reference field then Reference qualifier is what you are looking for. Please refer below link for more info.


Reference Qualifiers for Service Catalog Variables - ServiceNow Wiki


http://wiki.servicenow.com/index.php?title=Reference_Qualifiers#gsc.tab=0


Reference Qualifier on Lookup Select Box Variable


Nate23
Mega Guru

if you have some type of reference/ lookup select box/list collector that you are trying to make dependent then try looking at the attribute ref_qual_elements.



you would add this to the attribute of the dependent variable like ref_qual_elements=depends_on_variables1,depeneds_on_var2



This tells the server to go fetch an updated query... you can use g_form.clearValue('var_name'); when a dependent var changes so old values dont stick.


It worked and by my surprise, it also worked with dotted fields. This is what I did to make it work:


Image 1.png