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.

How to make the work notes mandatory when Assigned to or Assignment group changes

kal123
Tera Contributor

Hello,

 

I would like to make work notes a required field when an Incident is re-assigned to another group or to another user. I would like to stop the incident from getting re-assigned until the work notes has been filled out, also I'm trying to get a message that says "Please Add Work Notes When Reassigning" so the user can understand. Would anyone be able to assist?

 

Thank you,

1 ACCEPTED SOLUTION

dgarad
Giga Sage

Hi @kal123 

You can write an Onchange client script on the assignment group 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   var assignment_group = g_form.getValue('assignment_group');
   if (assignment_group !== '' && oldValue !== newValue) {
      g_form.setMandatory('work_notes', true);
   }
}
If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad

View solution in original post

7 REPLIES 7

Thank you for the help!

I tried this solution and after I reassign my assignment_group, the work_notes become mandatory but the ui action "post" disappears

Jitendra Diwak1
Kilo Sage

Hi @kal123,

 

Whenever you change the assignment group and assigned to empty them you have to perform this onChange client script. 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   var assignment_group = g_form.getValue('assignment_group');
   if (assignment_group == '' && oldValue != newValue) {
      g_form.setMandatory('work_notes', true);
   }
}

 

Please accept my solution if it resolves your issue and thumps 👍 up

 

Thanks 

Jitendra 

Please accept my solution if it works for and thumps up.