We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Implement Integration Error Alerts(I need to be notified when the Mainframe Import fails)

Not applicable

Please provide me with development steps and transform script for below story:

chetanasand_0-1776369832565.png

chetanasand_1-1776369862231.png

Thank you in advance!!

 

1 REPLY 1

Tanushree Maiti
Tera Patron

Hi @Community Alums ,

It can be done in several ways.

 

Option 1: Create an onComplete script on your transform map.

 

Screenshot 2026-04-18 141757.png

 

Active: true
Type: onComplete
 Sample Script (not tested):

 var importSetRun = new GlideRecord('sys_import_set_run');
    if (importSetRun.get(import_set.sys_id)) {
        if (importSetRun.state == 'complete_with_errors' || importSetRun.state == 'error') {
            var grINC = new GlideRecord('incident');
            grINC.initialize();
grINC.short_description = '[service (mainframe / control M)] ->' + import_set.name + '[Error]';
grINC.description = '[service (mainframe / control M)] ->' + import_set.sys_id + ' failed. Check details: ' + gs.getProperty('glide.servlet.uri') + current.getLink();
grINC.business_service = <sys_id of Servicenow> ; //Update it
grINC.business_impact = <Delayed batch job fixes>;
grINC.assignment_group = <sys_id of ITSM Tools - ServiceNow Platform Support teams group>;
grINC.caller = <sys_id of service account by which all jobs run in your instance> ; grINC
.insert(); } }

Ref: https://www.servicenow.com/community/itsm-forum/automatic-incident-creation-from-transform-map/td-p/...);

 

Option 2: By  Creating a  Update Business Rule 

Table : Transform History table [sys_import_set_run]

When to run : state changes to 'Complete with Errors'.

Update : true

Insert : false.

Sample Script  (Not tested):

var grINC = new GlideRecord('incident');
grINC.initialize();   //Incident Details you update as per your requirement
grINC.short_description = '[service (mainframe / control M)] ->' + current.name + '[Error]';
grInc.description = '[service (mainframe / control M)] ->' + current.sys_id + ' failed. Check details: ' + gs.getProperty('glide.servlet.uri') + current.getLink();
grINC.business_service = <sys_id of Servicenow> ; //Update it
grINC.business_impact = <Delayed batch job fixes>;
grINC.assignment_group = <sys_id of ITSM Tools - ServiceNow Platform Support teams group>;
grINC.caller = <sys_id of service account by which all jobs run in your instance> ;
grINC.insert();
}

 

3. Using Flow also you can achieve the same.

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti