Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to trigger notification through event when data loaded and got error through Transform map

Chaitanya Redd1
Tera Guru

Hello Team,

I'm trying to trigger a notification when any user's try's to load a data using transform map and he gets few error/skipped/ignored.

I have created notification and trying to trigger using event but how to use event on transform map table. 

 

Can anyone help me with the steps if possible.

Thanks,

Chaitanya

1 ACCEPTED SOLUTION

Hi Chaitanya,

in that case you need to query the staging table with the import set number and print the information

Sample below: just enhance it

(function runMailScript(current, template, email, email_action, event) {
   
template.print("<table width=70% border=1><tr bgcolor=#e2e0de><td>Row</td><td>State</td><td>Error</td><td>Comment</td></tr>");

var gr = new GlideRecord('staging table');
gr.addQuery('set', current.set);
gr.query();
while(gr.next()){

template.print("<tr><td>gr.sys_import_row</td><td>gr.sys_import_state</td><td>gr.sys_row_error</td><td>gr.sys_import_state_comment</td></tr>")

}

template.print('</table>');
   
})(current, template, email, email_action, event);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Chaitanya,

below link has the solution/approach. please go through

https://community.servicenow.com/community?id=community_question&sys_id=2c12b4d5db95d49014d6fb243996...

https://community.servicenow.com/community?id=community_question&sys_id=5dd54b21db1cdbc01dcaf3231f96...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks Ankur, I need one help here i'm creating notification how to show this fields and there values

like below in a table form. I have tried email script but no use. Can you help me how to show this fields in notification.

find_real_file.png

 

Thanks,

Chaitanya

Hi,

you can get to know how many records got inserted/skipped/updated etc

See below; Hope this helps you get started

Email Notification:

find_real_file.png

find_real_file.png

Email Script:

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I need this in table form as shown below 

find_real_file.png

Can you help me I have written below script but it's not showing up

 

var transformhistroy_information="<table style='font-family: arial, sans-serif;  border-collapse: collapse;  width: 100%;'><tr><th style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>Row.</th><th style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>State</th><th style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>Error</th><th style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>Comment</th></tr>";

 

transformhistroy_information+="<tr><td style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>"+row+"</td><td style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>"+state.getDisplayValue()+"</td><td style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>"+error.getDisplayValue()+"</td><td style ='border: 1px solid #dddddd;  text-align: left;  padding: 8px;'>"+comments+"</td></tr>";