Unable to fire a Event from OnComplete transform script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:43 AM
Hello All
I'm trying to fire a event from Oncomplete transform script, but event is not getting triggered when transform is complete.
Here is the script:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
gs.eventQueue('sn_grc.issue_state_review_reminder_3', target );
})(source, map, log, target);
Attached a notification screenshots:
1.
2.
Thanks.!
Kartik Magadum
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 02:46 AM
onComplete won't know the target object as it runs only once when the entire transformation is done
You can use GlideRecord and query the target table and simply give the GlideRecord object there
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord("tableName");
gs.eventQueue('sn_grc.issue_state_review_reminder_3', gr);
})(source, map, log, target);
if you want the event to trigger on every row you can use onAfter and then it will pick the correct target object
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
05-14-2025 02:59 AM
Hello @Ankur Bawiskar
Thanks for quick response.
I tried the script by querying the target tablet, still unable to fire the event.
Please let me know, if the below script is correct or not.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord("sn_grc_issue");
gr.query();
gs.eventQueue('sn_grc.issue_state_review_reminder_3', gr);
})(source, map, log, target);
Thanks.!
Kartik Magadum
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 03:17 AM
don't use gr.query()
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord("sn_grc_issue");
gs.eventQueue('sn_grc.issue_state_review_reminder_3', gr);
})(source, map, log, target);
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
05-14-2025 03:28 AM
Earlier i used same but not working🙁