Client Script onChange is not triggering at all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi everyone,
I’m currently facing an issue with a Client Script onChange script that is not being executed at all.
The strange thing is that it is not a logic issue inside the script — the script does not seem to trigger in the first place. I already added logging statements at the very beginning of the Client Script, but nothing appears in the console/logs when I change the field value.
Has anyone experienced a similar issue or has an idea what could prevent an onChange Client Script from firing?
Things I already checked:
The Client Script is active
The field name is correct
The script type is set to onChange
I tested with simple log statements at the first line
The field value is definitely changing
Are there any less obvious reasons why an onChange Client Script would not trigger at all? For example, any configuration settings, UI policies, field types, client conditions, or other dependencies that could block it?
Any hints or troubleshooting tips would be highly appreciated. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hi @colin-lucwe ,
A few things I'd suggest checking:
- Verify that the Client Script UI Type is set to All (Desktop, Mobile, and Service Portal), or at least includes the UI where you're testing.
- After changing the field value, tab out or move to another field, as the
onChangeevent only fires when the field loses focus. - Double-check your script for any syntax errors. You can even paste it into ChatGPT or another code validator to verify the script is correct.
- Also check the browser console for any JavaScript errors that may be preventing the script from loading.
Regards,
Tejas
If you found my solution helpful, please mark it as Helpful and Accept Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @colin-lucwe ,
If you are ok please try this,
Create a new onChange script. Do not seperate the isloading & newValue function as from ur script i understand u r not doing anything. You just want your script to run on change of the variable value. So let the OOTB function which appears be as it is.
After that put an alert("testing"), it should appear. Then paste ur actual logic of setting/removing values.
Thanks,
Danish Bhairagdar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
It still doesn't work. The client script is only executed when the form loads. After that, it never triggers again when the field value changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @colin-lucwe,
Case is part of Customer Service Application. Your script is in global application. Please create another script within Customer Service Application and see if it works.
Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.
Kind Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I also tried creating a client script in the Customer Service Application, but I'm seeing the same behavior. The script runs on form load, but it isn't triggered when the value of the field changes.