We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Making the worknotes mandatory when the priority changes

robinchadwick
Mega Expert

In the Incident Management application, how do I make the worknotes mandatory when the priority changes.

1 ACCEPTED SOLUTION

Swapnil Bhakar1
Mega Guru

Hi Robin,



Follow below steps to make work notes field mandatory on change of priority.



Select Table name: Your table name (e.g. Incident)


Type: onChange


Field Name:   Priority



Script:



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue === '') {


          return;


    }




    //Clearing the value of Owner field on change of Owner Group


      if(newValue != oldValue)


    g_form.setMandatory('work_notes',true);


}



Hope this will help you.



Regards,


Swapnil



PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

12 REPLIES 12

UI Policy.


Why is {   if(newValue != oldValue)  } necessary because I am doing the same think without the if Condition and I get same result. Can you explain

 

Lana2xp
Tera Contributor

i have tried ui policy and script but it doesnt work!!! what should i do?