Changing Field label using setLabelOf() based on other field value not working

Lina5
Tera Contributor

Hi Everyone,

Issue: setLabelOf() is not changing the field label dynamically on catalog item form.

I have below requirement to change the Field Label on below condition.

On the catalog item I need to change the "Additional Notes" field to read as "LSR Remarks", and make it as mandatory. When Request type field has vale "Porting orders".

For all other request types it should remain the same as previous, optional Additional Notes.

I tried below Onchange script on catalog item (variable name --> request_type) --> Field is set to mandatory when newValue === 'Porting orders' but not Changing the label.
how can I fix this? 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
  var additionalNotesField = g_form.getControl('additional_notes');
 
    if (newValue === 'Porting orders') {
 
        g_form.setLabelOf('additional_notes', 'LSR remarks');
        g_form.setMandatory('additional_notes', true);
    } else {
 
        g_form.setLabelOf('additional_notes', 'Additional Notes');
        g_form.setMandatory('additional_notes', false);
    }
}
Lina5_0-1738167467264.png

 




Thanks in advance!

 

0 REPLIES 0