Can I have a client script run only when the user manually changes the field value, not when it's changed by a script?

Sheryl Lyke2
Tera Guru

I have an onChange client script that runs on a parent record (custom table) when the renewal state field changes. It then updates any child records to the same renewal state. Sometimes the user will need to only change the renewal state on a few of the child items individually. There's a business rule that runs on the child record that goes through all of the items and if there are different states, it updates the parent to 'Mixed Renewal States'. When this business rule runs, I don't want the client script to run. I only want it to run if they manually update the renewal state field on the form. Is this possible?

Thank you!

1 ACCEPTED SOLUTION

The SN Nerd
Giga Sage
Giga Sage

"I have an onChange client script that runs on a parent record (custom table) when the renewal state field changes"

Are you sure? I can't think of any valid use case to do this.

You can change a field on a record and then not save it, which is not a valid cause to trigger a change to another record. It is not considered the best practice to do this!

I strongly consider you revisit this implementation as a business rule.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

7 REPLIES 7

I have the same issue when I change it to a business rule. I added setWorflow to false but when I change the value on the child record, it changes the value on the parent record which then changes all the children records

The SN Nerd
Giga Sage
Giga Sage

"I have an onChange client script that runs on a parent record (custom table) when the renewal state field changes"

Are you sure? I can't think of any valid use case to do this.

You can change a field on a record and then not save it, which is not a valid cause to trigger a change to another record. It is not considered the best practice to do this!

I strongly consider you revisit this implementation as a business rule.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

You're right. I'm revamping a previous process which used scripts to allow the user to see the changes right away. But that doesn't make the most sense