OnChange: trigger an onchange script when a form field has been populated using another script?

ServiceLater1
Giga Contributor

I have an OnChange client script watching a field in a form on a page in the service portal. It triggers when I enter text into the field manually but not when my custom widget client script populates the field (using jquery).

Is there a way to get an OnChange client script to trigger even if the form field has been populated by another script?

1 REPLY 1

Anitha H V
Giga Expert

Hi ,

Onchange client script can be triggered when

-->If the change on the field was done as part of form load

-->If the change on the field is due to the population from a template.

/Stop script execution if the field value change was caused by a Template or as part of the form load.

 if(isLoading || newValue === '' || isTemplate)

{    return;   }

if the value of the field is getting updated by the script when the form loads then removing the isLoading condition may work.

Thanks,

Anitha H V