- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 12:57 PM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 04:27 PM
"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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 01:02 PM
Yes. I think, it is like that already.
Unless a user open a UI and change something, it wont run the client script.
So even if a business rule on child trigger changes, it shouldn't trigger client script on parent.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 01:06 PM
That's what I was hoping but the client script calls a script include which writes to the log and I can see the entries when updating the child record. I'm doing it from a related list while on the parent record so maybe that's why?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 02:57 PM
Yes. That could be the reason.
Are you sure, a client script is doing that?
Because you are not suppose to update child record using an onChange client script. You should be using a Business rule to update the child records. If you use onChange client script, it will update the child state, but what if you dont save the parent record?
So I would suggest, you confirm, it is a client script doing that.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 04:46 PM
That's a great point.