Display Annotation field on Change Mgmt form based on another field

stevezempke
Tera Contributor

on my change mgmt form, i have a field called 'reason for change'.  when i select an option, say option A, from that list, i need to have an annotation field display but only for that option.  any other selected option, options B-Z, from the 'reason for change' list should not display the annotation field.

currently i have it displaying on the form for all reason's for change as i can't find the process to toggle it.

not sure if annotation is the correct way to do this or if some sort of message or information text box would work.

any thoughts and steps to help out would be appreciated.

Thanks.

Steve

11 REPLIES 11

Yes, remember to replace "reason_for_change" with the field Id. You can find it by right clicking the field.

A small addition to your script LZ

In his requirement he need to hide the field too.

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

   if (newValue == 'option a'){

      g_form.setVisible('reason_for_change',true);
      g_form.showFieldMsg('reason_for_change', 'Display the following message', 'info');
   } 
else
 {
      g_form.hideFieldMsg('reason_for_change');
      g_form.setVisible('reason_for_change',false);
   }
}

 

-Vinay.

next question.  i can see the message appear on the change form as i fill out the form but when i click 'Request Approval', the message disappears.

how can i have the message stay on the screen throughout the life of the ticket versus just appear at entry.

Slight modification to above script. just commented out if block.

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

   if (newValue == 'option a'){

      g_form.setVisible('reason_for_change',true);
      g_form.showFieldMsg('reason_for_change', 'Display the following message', 'info');
   } 
else
 {
      g_form.hideFieldMsg('reason_for_change');
      g_form.setVisible('reason_for_change',false);
   }
}

 

-Vinay.

Glad that worked. mark the original answer as helpful and correct you you can help others facing a similar issue