Trigger a notification when transform map fails

Priyanka145
Tera Contributor

Hi All,

I need to send a notification to certain group when transform map fails, I am using schedule to run the transform map daily.

I also require a notification with the number of insert, update, etc and other notification should trigger when transform map fails.

Please guide me here

1 ACCEPTED SOLUTION

Hi @Priyanka145 ,

 

You don't have to deal with Transform Maps for this. In your BR that you have written on Transform History table , use the below script:

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var message = "";
    var grLog = new GlideRecord("sys_import_set_row_error");
    grLog.addQuery("run_history", current.getUniqueValue());
    grLog.query();
    while (grLog.next()) {

        message = message + grLog.error_message + " for Row Number - " + grLog.row.getDisplayValue() + "\n";


    }
    if (message != "")
        message = "<b><u>Error in data transformation:</b></u> <br\>" + message;

    gs.eventQueue("th.transform.status", current, message, "");


})(current, previous);

 

Now finally add this message that you have sent in your event as parm1 to your notification as shown below :

kamleshkjmar_0-1666858073793.png

Now when your event will trigger if there is any error while transform, it will appear in your notification:

 

kamleshkjmar_1-1666858420867.png

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

 

 

View solution in original post

9 REPLIES 9

Anil Lande
Kilo Patron

Priyanka145
Tera Contributor

Hi Anil,

I have followed one of the link provided and trying to trigger a notification using an event , and  Business rule is created for it.

Notification is getting generated but values are not populating . Please help me here.

Priyanka145_0-1666778081136.png

BR written on Transform History table.

(function executeRule(current, previous /*null when async*/ ) {
var importSet = new GlideRecord('sys_import_set');
importSet.addQuery('sys_id', current.set);
importSet.query();
if(importSet.next()){
gs.eventQueue("DataLoad.completed", importSet, importSet.sys_id, importSet.number);
}

})(current, previous);

 

In the notification part, when event is fired, given the event name

Priyanka145_1-1666778219659.png

 

When I previwed, I could see all the values in it. But for the email generated, the values are empty as below. Only number is getting populated.

Priyanka145_2-1666778269353.png

 

@Ankur Bawiskar  Could you please guide me here

 

 

Hi @Priyanka145 ,

 

You are querying the wrong table, Modify the condition of your BR (I assume your BR is on Transform History Table) and put it something like shown below :

 

kamleshkjmar_0-1666779801068.png

 

No need to GlideRecord to any table. Just trigger the event in the script and pass the current record. Your notification will work fine.

 

 

 gs.eventQueue("DataLoad.completed", current, '', '');

 

 

Let me know if this do not works.

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

 

 

 

Hi Kamlesh,

I also need to display total number of inserts, updates, skipped, ignored 

So, all these are available on the Transform history table only sys_import_set_run. I am using this table only

 

Priyanka145_0-1666783354401.png

 

I need to show the total , insert, updates, etc and at the bottom 2 are skipped.

I also need to show them over the email with comment.

Please guide