Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

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
Tera 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);
   }
}

View solution in original post

7 REPLIES 7

dgarad
Tera 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);
   }
}

kal123
Tera Contributor

Thank you! Will this also apply to the assigned_to field?

yes, you can use it.

Dnyaneshwaree
Mega Sage

Hello @kal123 ,

Follow below steps:
1. Create BR
2. Table: incident table
3. In when to run add conditions i.e., assigned to changes or assignment group changes.
4. Check advanced checkbox.
5. In advanced script use - 

  if (current.field_name == "") {
        gs.addErrorMessage("Field abc is empty!");
        current.setAbortAction(true);
        action.setRedirectURL(current);


Or
use onchange client script - onchange field = assigned to or ass grp
And add logic - g_form.setmandatory('fieldname') ;
and alert() message or g_form.addErrorMessage(message).
with abort action and workflow set to false.

Please accept my solution if it works for you and thumps up to mark it as helpful.

Thank you!!