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 03:33 AM
try this
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord("sn_grc_issue");
gr.setLimit(1);
gr.query();
gr.next();
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:44 AM
what's your business requirement here?
Do you want notification to run only when data load happens?
If yes then you should use onAfter so that it sends email for each row
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:38 AM
Hi @Kartik Magadum ,
Is there any specific reason why you are trying to trigger the event from onComplete transform map script?
The eventQueue method uses gliderecord which should essentially point to a record from table in ServiceNow. So if you want to trigger a event you need to have a record through which you are triggering the event.
From your screenshot I can see that you are trying to send the notification to issue manager. So, where are you getting the value of issue manager from? If there is a record through which you are getting the value we can GlideRecord to that record in the onComplete transform map script and it will solve the issue.
Mark the answer as correct and helpful if it resolves your issue. Happy Scripting 🙂
-Shantanu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 03:30 AM
Hi @Kartik Magadum ,
Try this
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord("sn_grc_issue");
gr.query();
if (gr.next())
gs.eventQueue('sn_grc.issue_state_review_reminder_3', gr,null,null);
})(source, map, log, target);
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 04:01 AM
Hi @Kartik Magadum ,
Is there any specific reason why you are trying to trigger the event from onComplete transform map script?
The eventQueue method uses gliderecord which should essentially point to a record from table in ServiceNow. So if you want to trigger a event you need to have a record through which you are triggering the event.
From your screenshot I can see that you are trying to send the notification to issue manager. So, where are you getting the value of issue manager from? If there is a record through which you are getting the value we can GlideRecord to that record in the onComplete transform map script and it will solve the issue.
Mark the answer as correct and helpful if it resolves your issue. Happy Scripting
-Shantanu