- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 12:52 AM
I made an observation and thought it worth noting here in the community.
We use Agent Workspace in our organisation, alongside NextUI.
I have an onChange client script that looks for changes on field A, and sets the value of field B.
Another onChange client script looks for changes on field B and performs an action.
I found that in Agent workspace, the second client script does not trigger when filed B is updated by the first script.
The second script triggers fine if the trigger is manual form manipulation.
In nextUI, the second script is triggered by the first without issue.
I thought it worth noting the observation in here, to see if anyone else has experienced similar.
I worked around it by merging the required logic into the first client script.
Steps to replicate:
Create an onChange client script that looks for changes on a field (A) and uses g_form.setValue to set field B
Create an onChange client script that looks for changes on field B
Observe that (in Agent workspace) script 2 only triggers when field B is manually changed, not when script 1 runs
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 02:43 AM
if the 1st script is triggered via UI then 2nd should also trigger if it's onchange
Trigger for 1st script has to be from UI and then only it will work
Seems we are not able to get what you are trying to explain.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 01:57 AM
Hi @NToo ,
So you are saying 2nd script is not event getting called in workspace view?
Did you try putting alert to check ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 01:59 AM
Yes, thats correct. I tried removing all parts of the script, and just put an alert.
By doing this, I was able to confirm the 2nd script doesnt run.
The 2nd script runs fine if I manually change the field value by interacting with the form - I did this to confirm the script itself was not the issue but rather the trigger.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 02:02 AM
Which work space are you using? i tried in SOW while simple crating two onchange client script and it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 01:48 AM
Hi @NToo ,
It should work in both, seems you have not selected UI Type = All.
Just now i have tested its working in both places if you keep UI Type=All.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 01:51 AM
Hi Runjay,
I appreciate the response - this was indeed the first thing I checked and can confirm both scripts are set to All.