Notification need to send whenever data got placed in target table through sch

Aakhiil
Tera Expert

Hi Experts

Good day!

am new to ServiceNow. I got one requirement. In existing I have a transfer map data load on "u_swim" table through schedule imports daily at 8am.


here my requirement is :  I have to send a notification to "trai" team daily whenever the records got inserted and updated in "u_swimlane" table with the number count of how many records got inserted and how many records got updated and how many records got rejected in a stagging table while data got loaded into target table I.e "u_swimalane"

How can I achieve this I have seen some video's and created a event in event registry [name: sfx_event ] and also in notifications I have created a new notification [name:SFX Data load] and selected event is fired and and picked up the event name and I checked the insert and update check box.
I am not aware about the schedule job script and in notification script
Could you please help me with the scripts in scheduled job and notification 


Any help will be appreciated

PFA

Thanks
Aakhil 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Aakhiil 

you should have notification on this table (sys_import_set_run) and it will run when the transform is complete.

Create a group with the email to whom it needs to be sent

you can then send the list of inserts, updates etc

AnkurBawiskar_0-1714140222882.png

Include the group in Who will receive section

Then include the body like this

AnkurBawiskar_1-1714140476262.png

 

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

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Aakhiil 

you should have notification on this table (sys_import_set_run) and it will run when the transform is complete.

Create a group with the email to whom it needs to be sent

you can then send the list of inserts, updates etc

AnkurBawiskar_0-1714140222882.png

Include the group in Who will receive section

Then include the body like this

AnkurBawiskar_1-1714140476262.png

 

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

Thanks for your help @Ankur Bawiskar 

Thanks a lot 

Hi @Ankur Bawiskar 
Thanks for your help I have created a notification and event on (sys_import_set_run) table.
Notification : SFX Data load (Pic1)
Event : sfx_dataload (pic2)
But here I need to call the notification & event in my schedule job script. But existing I already have some script can you please help me with the scheduled job script how can I modify/add  (pic3)
schedule job existing script :

var gr = new GlideRecord('sys_data_source');
var dataID = gs.getProperty('swimlane1.sfx.material.id.data.source');
if(gr.get(dataID)){

var gdt = new GlideDateTime().getLocalDate().getByFormat("yyyy-MM-dd").toString();
var arrD = gdt.split('-');
var fileDate = arrD[0]+arrD[1]+arrD[2];
var path = gr.file_path;
var x = path.indexOf('CustMat');
var newPath = path.substring(0,x);
newPath = newPath +'CustMat_'+fileDate+'.csv';
gs.log('SL1 material ID SFX path : ' + newPath,'SFX_LOAD');
gr.file_path =path+newPath;
gr.update();
gs.log("****LOK file updated",'SFX_LOAD');
}

gs.log('****LOK schedule started','SFX_LOAD');

 

Aakhiil_0-1714737997219.png

Thanks

Arsshad