Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Stop onchange client script trigger when the same filed value updated in on load client script.

MADHUSUDHANS953
Tera Contributor

I am trying to update a filed value in onload client script, and the same filed has onchange client script and its also triggering when onload. So how can we stop this trigger.

3 REPLIES 3

Vasanthi_L
Tera Contributor

 Hi Madhusudhan,

 

Option 1: Use an onChange() client script instead of onLoad() to update the field value. This prevents duplicate execution since onChange() runs both on field 'change' and form 'load'.

Option 2: Use only an onLoad() client script to update the field and deactivate the onChange() client script to avoid unnecessary execution.

 

Regards,

Vasanthi Lanakda

 

Vasanthi Lankada

Thanks I will try 

Vasanthi_L
Tera Contributor

Hi Madhusudhan,

Option 1: Use an onChange()  client script instead of onLoad() to update the field value. This prevents duplicate execution since onchange() runs both on field change and form load.

Option 2: Use only an onLoad() client script to update the field and deactivate the onChange() client script to avoid unnecessary execution.

Regards,
Vasanthi Lankada

 

Vasanthi Lankada