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

Hi @Priyanka145 ,

 

Yes, so if you see all these values of inserts/updates/skipped/ignored are stored in Transform History table.

 

Now inorder to retreive these values you need to pass record of this table only in the event so that notification could access these fields from the passed record.

 

kamleshkjmar_0-1666783031069.png

 

Also make sure you select the Table name as Transform History even if you are calling it through event only. This helps in selecting field names

kamleshkjmar_1-1666783115379.png

 

I Hope this helps.

 

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

 

Regards,

Kamlesh

Yes, I am writing notification on Transform history table only and even my BR is on the same table, and also the event that is creatd is also on same table

Priyanka145_0-1666785092803.png

 

I will try above but meanwhile can you also please let me know how can I get the comment for those skipped or ignored ones.

I also need to display what is the reason for the skipped.

@Priyanka145 ,

 

For ignore/error messages, you will have to GlideRecord to the Import log [import_log] table with query, level IN 1,2 and import_set=current.set

 

Then build a message variable concatenating the value of message field of import_log table. In the end send this message as a param1 in your event and print this param in  notification body.

 

I Hope this helps.

 

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

 

Regards,

Kamlesh

Hi @kamlesh kjmar 

I am able to display the values for insert, update, etc as per your approach. Thanks for it

Could you please help me with the script or with the screenshots as I am new to Transform maps.

 

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