Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

update field based on two reference fields

si21
Tera Guru

 

Hi Experts,

 

I need to update a choice field based on two other reference fields on a HR case form.

 

What is the best approach for this

 

TIA

1 REPLY 1

Anand Kumar P
Giga Patron

Hi @si21 ,

 

You can achieve this by creating an onChange Client Script on the second reference field. Use the g_form.getValue() method to retrieve the sys_id of both reference fields, or use the g_form.getDisplayValue() method if display values are needed. Implement an if condition to check if the values of both reference fields match the desired criteria, and use g_form.setValue() to update the choice field accordingly.

 

 

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand