- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Every day we have scheduled export to send files from ServiceNow -> MID Server -> GCP. But it have possibility failed to transfer when we got authentication fail during MID Server -> GCP (intermittent).
My objective is to send email notification by triggering event when we meet catch (e) {} condition below.
But notice MID Server Script Include [ecc_agent_script_include] doesnt support gs.eventQueue.
Is there other way to trigger email notification when having script error at MID Server Script Include?
Thanks
FileTransfer: function() {
try {
var localFileName = this.MIDSERVER_FILE_PATH + "/" + this.MIDSERVER_FILE_NAME;
var processedFileName = this.MIDSERVER_PROCESSED_PATH + "/" + this.TARGETFILENAME;
this.log("Copying from local file of MID Server: " + localFileName);
this.sftpFile(this.targetServer, this.targetUsername, this.targetPassword, localFileName, this.targetPath + this.TARGETFILENAME, processedFileName);
} catch (e) {
this.log("Error in writing file to SFTP server: " + e);
//>>>>>> trigger email notification <<<<<<<<
}
},
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
yes that's correct, mid server script include cannot use gs.eventQueue()
May be try to use this approach (I haven't tested this)
1) In your catch block, create a custom ECC Queue payload from your script include instead of trying gs.eventQueue. This payload acts as a message to the instance indicating an error or status.
2) On the ServiceNow side, configure Business Rule on the ecc_queue table to process this signal and trigger an event or notification when error conditions are received.
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
yesterday
yes that's correct, mid server script include cannot use gs.eventQueue()
May be try to use this approach (I haven't tested this)
1) In your catch block, create a custom ECC Queue payload from your script include instead of trying gs.eventQueue. This payload acts as a message to the instance indicating an error or status.
2) On the ServiceNow side, configure Business Rule on the ecc_queue table to process this signal and trigger an event or notification when error conditions are received.
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
yesterday - last edited yesterday
Thanks Ankur,
I can use GlideRecord insert() and trigger event from inserted record.