Email notifications: Getting multiple emails for every record auto-updated in a table, just want 1 email

cathytyner
Kilo Expert

Hi all!

I have a custom table u_classroom_codes with 86 records. Every 3 months I replace data in the table with a scheduled data import. I have an email notification set up so that I receive an email letting me know that the table has been updated with current data. I get 86 emails. I assume I'm getting one email for every record that has been updated. I just want to get one single email so that I know the table has been updated. Can someone suggest how to setup my email notification correctly? Below is a screen shot of how it is currently set. Please note I'm a newbie with no scripting experience.

I think the problem is that the table I selected within 'Email Notifications' is my table with 86 records. The notification is doing as it's told and alerting me every time a record is updated. Maybe I can select a different table such as one that that will only have one records which updates upon my successful data load or maybe when my scheduled job has been completed...?

Components:

  • Table: u_classroom_codes (always 86 records)
  • Data Source: auto_load_classroom_codes
  • Table Transform Map: Auto Classroom Code load
  • Scheduled Data Import: Classroom Codes
  • Registry: classroom_codes_update.completed
  • System Policy > Notifications: "Notify that Classroom Codes table data updated"

Screen Shot 2015-03-11 at 11.08.45 AM.png

Much thanks!!

Cathy

1 ACCEPTED SOLUTION

edwin_munoz
Mega Guru

Hello Cathy,



You can follow these steps to get the notification you want.



1. Create event in System Policy -> Events -> Registry


      Name: classroom.import.completed


      Table: Import Set


2. Go to the Auto Classroom Code load transform map and select the Transform scripts tab. Create a new transform map script:


      When: onComplete


      Script:


gs.eventQueue("classroom.import.completed", import_set);



3. Edit your notification to be sent when an event is triggered and select the classroom.import.completed event.




EDIT: Maybe you don't have to create a new event and you can use the one you already have.classroom_codes_update.completed.



Who should receive this email? is it always going to be you? or the person who runs the import?




View solution in original post

36 REPLIES 36

Cathy,



How is the event appearing in the event log? Is it being assigned to the correct table?



Do you have a condition in the email notification?


I believe the event is being assigned to the correct table. See screen shot below, you can see the last 3 tests after setting the sys_import_set table.


Screen Shot 2015-03-11 at 3.47.02 PM.png



No condition set in the email notification:



Screen Shot 2015-03-11 at 3.50.50 PM.png


Hi Cathy,



Yes the event is working fine. That Keywords are condition confuses me, can you please remove it? just to make sure that it is not causing problems.



I'm not sure if it matter but... do you have enabled mail sending in your instance?


In the process of removing the condition as you suggested, I saw the actual problem. I had renamed my event earlier, and I did not update the event name in the post script on import (see pic below). Once I named this event in the import script correctly, the email was generated! Excellent!!!



However, in my email I want to include a field from my u_classroom_codes table so that the subject of the email reads:


Classroom Codes data updated for ${u_quarter}



Before these changes, this field was working (when I was receiving the 86 emails and my email was triggered on the u_classroom_codes table update rather than the event of the import as we changed it to.


So now my subject of my email looks like this: "Classroom Codes data updated for           "



And it should say, "Classroom Codes data updated for Spring Quarter 2015" where Spring Quarter 2015 is from field "u_quarter" in table "u_classroom_codes".



Is there still a way to include the field "u_quarter" in my email? Now that the "u_classroom_codes" table is no longer listed in my notification, I don't see it as an option to select when I set up my email notification.



codes.jpg


Great!



Yes you can pass the value to the notification when you create the event:



gs.eventQueue("classroom_codes_import.completed", import_set, target.u_quarter);



The first parameter of the event function is the name of the event


The second parameter is the sys_id of the record (this case the sys_id of the import set). This lets you use the import set fields in the email notification.


The third and fourth parameters are used to send extra information.



In this case the third parameter contains the quarter information and you can access it from the notification as: event.parm1