- 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 02:24 AM
it worked for me as well
Refer below
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 02:32 AM
Hi Ankur,
I believe that your test scenario is a script setting value of field based on change of a field by user input, which is slight different to my scenario.
My scenario is that that field that triggers the script, is changed by another script, therefore script 1 does not trigger script 2.
I'm not sure if I'm explaining that very well.
Script 1 : onChange that looks at 'state' field. When state changes, set Assignment group to X
Script 2: onChange that looks at 'Assignment group' field. When AG changed, set 'Assigned to' to Y
Triggering script 1 by changing the state, causes AG to be set to X, but script 2 is not triggered, therefore 'Assigned to' is not set.
Triggering script 2 manually by manually (user input) changing AG to X, correctly causes script 2 to trigger and 'Assigned to' is set
- 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 03:02 AM
Thank you!
I have now managed to get to the bottom of this with your kind assistance.
Your working example helped me to recreate my own working example.
By doing this, I was able to focus in on my original scripts and pick apart any issues, knowing that the functionality should work.
What it turned out to be:
Script 1 was setting a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 03:04 AM
Glad that I was able to help you
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader