Make variable field required on SC_TASK closed complete

dagarson
Tera Guru

Hello Im looking for a way to have a vairable field be Mandatory if the Task is set to closed complete.

Basically not allow users to close the SCTASK without filling out the variable. something like this.

find_real_file.png

Any help is appreciated. Thank you.

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

I have this requirement often.  An onSubmit Catalog Client Script that Applies on Catalog Tasks is the way to go.  You only need one script per catalog item.  You can, and probably will have many iterations of this requirement - this variable is mandatory on this task and that one, and this one is mandatory if the task is closed complete, incomplete, or skipped,... - all just modifications to the if statements below

function onSubmit() {
  if(g_form.getValue('state') == 3){//Closed Complete
    if(g_form.getValue('short_description') == 'Request a Knowledge Article'){//to make this variable mandatory when only this task closes
      g_form.setMandatory('v_testing_field', true);
      if(g_form.getValue('v_testing_field') == ''){
        alert('Testing field is required');
        return false;
      }
  }
}

View solution in original post

11 REPLIES 11

What did you come up with?