How can i Clear the values in all the variable fields which is dependent on other field select box, when value is changed in that select box automatically all the values should be cleared in form..

Asish1
Tera Contributor

Hi,

Here firstly I selected change type as Normal and gave the Short Description as Test and again I changed the Change type Value to Emergency but the value of Short Description not changed so how can i give the exact condition to clear the value and also similar to all other variables present in form.. Please help me with this 

 

Thanks.

find_real_file.pngfind_real_file.png

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Easier with Client Script.

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   if (oldValue != newValue) {
	   g_form.setValue('<fieldname>', ''); // have this for all the fields
   }
   
}

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you using client script or UI policy for this?

Regards
Ankur

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

Asish1
Tera Contributor

Hi @Ankur Bawiskar 

Thanks for the Reply!

Tried with UI policy like if Change Type is one of Normal, Emergency then clear the values but its not working...

Hi,

you can handle using client script easily.

I will suggest to start on it and if stuck members can help

Regards
Ankur

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

Hitoshi Ozawa
Giga Sage
Giga Sage

Easier with Client Script.

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   if (oldValue != newValue) {
	   g_form.setValue('<fieldname>', ''); // have this for all the fields
   }
   
}