Filter drop down reference field after changing dependency field value

marclindsay
Tera Guru

When displaying a Reference Field C as a drop down, how can I get the values to be filtered based on Fields A and B ?

I have 3 Reference fields. Field C values are dependent on what is chosen for Field A and B. I have created a Reference Qualifier to handle the filter for Field C. When changing the values of Field A and/or B, Field C automatically (without pressing Save/Update button) shows the correct new values based on these Fields A and B. All work great, as shown below. 

Now if I change Reference Field C to be a drop down. 

Now when I change the values for Field A and Field B, Field C (still reference field) does not refresh automatically (without pressing Save/Update button) with a new list of Values. 

When displaying a Reference Field C as a drop down, how can I get the values to be filtered / refresh automatically based on values selected for Fields A and B ?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I would recommend keeping field C as reference only and not drop down.

Reason being if the table is huge then it won't be a good user experience and user might have to scroll down to select the value.

Also advanced ref qualifier won't work on drop down field as per my understanding.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

johnfeist
Mega Sage
Mega Sage

Hi Marc,

You need to set up an advanced reference qualifier to provide the data.  Depending on your requirements is can be either dynamic or advanced.  Here's the link to the documentation on that.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

That is what I did. Works when Field C is still just a default reference field. 

Does not work when you switch the reference field into a drop-down reference field. Is there some trick to make this work with a drop-down reference field?

Hi Marc,

 

As far as I know, you can have a reference field or a drop down.  If you REALLY MUST have a drop down then you may have to resort to on change client scripts for the two other fields and have the script issue an AJAX call to the function that picks the acceptable values.  It should return both the label and sys_id.  From there your script will replace the choices in the list.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I would recommend keeping field C as reference only and not drop down.

Reason being if the table is huge then it won't be a good user experience and user might have to scroll down to select the value.

Also advanced ref qualifier won't work on drop down field as per my understanding.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader