Limit Reference field choices based on live changes

AjvadK
Tera Contributor

I have 2 reference fields category and sub-category, both referencing the sn_grc_choice table. The category values are set as parent for sub-category values. I need to limit the choice list for sub-category field, based on the category value chosen. I tried using reference qualifier advanced qualifier method using the following code:

javascript:"parent=" + current.category

 

It works fine for a new record, but for an existing record, it is only taking into account saved/server-side value. So real-time changes made to the category field are not being considered. 

1 ACCEPTED SOLUTION

@AjvadK 

try to add this in the Dictionary Attributes of the 2nd field

ref_qual_elements=category

AnkurBawiskar_0-1764854304368.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@AjvadK 

when you open an existing record which already has Category, it will filter Subcategory

try to add this in the Dictionary Attributes of the 2nd field

ref_qual_elements=category

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

 

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

Both fields are in Risk Statement form. Problem is when I make real time changes to category value, the sub category choice list doesn't reflect it. It only shows list corresponding to the saved category field value

@AjvadK 

try to add this in the Dictionary Attributes of the 2nd field

ref_qual_elements=category

AnkurBawiskar_0-1764854304368.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

This worked, thank you so much!