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

Ankur Bawiskar
Tera Patron
Tera Patron

@Kartik Magadum 

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.

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

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

@Kartik Magadum 

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.

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

@Ankur Bawiskar 

Earlier i used same but not working🙁