Sending Notifications from transform map scripts

ram173
Giga Expert

Dear All,

i have written script to send notification form transform map run script when inbound request comes to import set api. 

Event is generated and it getting processed with in 2 seconds but no email entry in email logs. 

i am able to preview email in notification window.

below line of code is used to trigger event from run script of transform map.

 

gs.eventQueue('importset.Incident.created',source,"test1@mail.com,test2@mail.com");

i have created Event and Notification on import set table.

Please let me know if missed anything here or let me know tips to troubleshoot it. 

Thanks,

Ram.

1 ACCEPTED SOLUTION

ram173
Giga Expert

Thanks Abhishek for responding my query.

 

I am able to triggering event from transform map run script and email is triggered with that event.

it was working after renaming event name with lowercase letters.

 

Thanks,

Ram.

View solution in original post

2 REPLIES 2

AbhishekGardade
Giga Sage

You can create a business rule on table sys_import_set_run and fire event as per defined conditions.

Events and Email Notification - ServiceNow Wiki

OR:

In your transform map, you can create an onComplete transform script that runs at the end of the import.

Transform map scripts

The advantage of an onComplete script is that you have access to the error flag along with several other objects.

When: The onComplete event script is processed at the end of an import run, after all data rows are read and transformed.

 

Import Set JS objectTypeContext in the onComplete import set event
sourceGlideRecordThe last row of the source import set table.
targetGlideRecordThe last row of target table.
import_setGlideRecordThe import set that is currently being transformed.
mapGlideTransformMapRead-only information about the current transform map record.
logFunctionThe log object for the current import run. For example, log.info(...), log.warn(...), log.error(...).
errorBoolean FlagWhen set to true, will mark the current import set status to error after it completes.

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade

ram173
Giga Expert

Thanks Abhishek for responding my query.

 

I am able to triggering event from transform map run script and email is triggered with that event.

it was working after renaming event name with lowercase letters.

 

Thanks,

Ram.