Unable to fire a Event from OnComplete transform script

Kartik Magadum
Kilo Sage

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. 

KartikMagadum_0-1747215597691.png

 

2. 

KartikMagadum_1-1747215631568.png

 

 

Thanks.!

Kartik Magadum

9 REPLIES 9

@Kartik Magadum 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Kartik Magadum 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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

 

Chaitanya ILCR
Kilo Patron

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

 

shantanu_patel8
Mega Guru

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_patel8_0-1747220486911.png

 

 

-Shantanu