How do I create an incident from error logging from an import

Bart Jan Bultma
Kilo Sage

We have an import that runs daily on a file with all existing workstations. In the onBefore transform script an error is logged if a new workstation is found that can't be coalesced to an existing record.

 

After the import I want to have an incident with an overview of the error logs so we can check these workstations manually. How do I do this? I have checked existing business rules and onComplete scripts but I cant find what I am looking for.

12 REPLIES 12

Peter Bodelier
Giga Sage

Hi @Bart Jan Bultma,

 

Are you using a scheduled import for this?
If so, you can use a post-import script, to query your data and create your incident.

PeterBodelier_0-1695304814604.png

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hello Peter,

 

Thanks for your answer. We are not using a scheduled import for this, so I was hoping to do this in an onComplete script

Ankur Bawiskar
Tera Patron
Tera Patron

@Bart Jan Bultma 

As mentioned by Peter you can use Post script

OR

You can also use onComplete transform script and check the current import set to see which rows got ignored because of coalesce value not found or which row has error. then create incident with all this data.

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,

 

Is there an easy/quick way to write these errors into an incident or should I just create a new record on the incident table and fill that as needed? something like this? How do I put the error log in the description?

var gr = new GlideRecord('incident');
gr.initialize(); 
gr.description = 'Import error'; 
gr.insert();