- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2025 12:26 AM
I have created an event to trigger Script Action and I have mentioned event in Business rule. But script is not triggering so it is not updating records.
I am writing script to update Network Adapters when Parent CI description is updated.
BR Script -
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2025 12:39 AM - edited 04-19-2025 12:47 AM
Hello @KS86 ,
You need to add "gr.update()" at the end of the while loop in the Script Action. This will save your updates.
...
while (gr.next()) {
gr.comments = "Parent CI desc updated as " + current.short_description;
gr.update();
}
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2025 12:39 AM - edited 04-19-2025 12:47 AM
Hello @KS86 ,
You need to add "gr.update()" at the end of the while loop in the Script Action. This will save your updates.
...
while (gr.next()) {
gr.comments = "Parent CI desc updated as " + current.short_description;
gr.update();
}
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2025 12:44 AM
is that event getting triggered and processed?
you forgot to include gr.update() as mentioned by @Robert H
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
04-19-2025 12:50 AM
Hi @KS86
Add gr.update() at the end of your script in the script action.
var gr = new GlideRecord('cmdb_ci_network_adapter');
gr.addQuery('cmdb_ci', current.sys_id);
gr.query();
while (gr.next()) {
gs.addInfoMessage("Previous Comments " + event.parm1 + "Previuos Domain " + event.parm2);
gr.comments = "Parent CI desc updated as " + current.short_description;
gr.update();
}
Regards,
Siva