The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to set a default value for choice field based on another choice field using configure dictionary?

Rahul Dev1
Giga Expert

Suppose if I have field a 'Priority' having choices P0,P1,P2,P3 and and field 'Status' having choices 'Serviced','Not Serviced'. Whenever 'Priority' is not P0 or P1 then 'Status' default value should be 'Not Serviced'.

I want to achieve this using default value in Configure dictionary.

Kindly Help!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you sure the Priority will be having some default value when form loads?

I believe you should be using onChange client script and achieve this if user changes the priority

Regards
Ankur

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

View solution in original post

6 REPLIES 6

dmathur09
Kilo Sage
Kilo Sage

Hi Rahul,

Use the below code in your Status default value

if(current.priority==0||current.priority==1||current.priority==2){'not_serviced'}

Regards,

Deepankar Mathur

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you sure the Priority will be having some default value when form loads?

I believe you should be using onChange client script and achieve this if user changes the priority

Regards
Ankur

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

Priority is None on form load

Hi,

then in that case you can use onChange client script on Priority as I mentioned and then set the value

Regards
Ankur

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