e-mail notification from an event..

Srikanth Menava
Kilo Sage

I wrote a recurring email - notification. I need a count of the notification in the email body..

To be precise I wrote an email notification that occurs continuously untill a specific condition is met. So, now what i need is to get the number in the email body.. i.e., if the email got triggered for the first time it needs to say 1st notification, and if its for the second time we need to say 2nd notification, so on.,

I hope I am clear, and I will get the answer for this.

1 ACCEPTED SOLUTION

Srikanth Menava
Kilo Sage

I achieved this by using the email scripts.. and using that email script reference in the notification..
here is the script...



(function runMailScript(current, template, email, email_action, event) {




                  // Add your code here


var count = event.parm2.toString();


if(count>0){


template.print("This is "+count+" reminder.");


  }


})(current, template, email, email_action, event);



and I called this script in the 'what it will contain' in the notification,



not.PNG


This helped me to achieve the requirment ,,
just in case if anyone have the same requirement.. Hope this will help them..


View solution in original post

18 REPLIES 18

Hello Jonathan,


I hope you didn't get my question properly.. I dont want a counbter field on a record,, what I want is I should get a counter on the email notification body...


If the notification is for 10 th time it should show 10th remainder in the body of the e-mail.


and If the notification is for 46 th time it should show as 46th remainder in the body of the e-mail.


hope this will give a very clear picture of my requirement.


Yes, I understand your requirement, but you have to store that counter somewhere because these events are stateless in a sense. You have to have somewhere to store that counter so you can continually access it.


NishantAkella
Giga Contributor
  • Create an integer field on the table you are trying to trigger an event off. Set the default value of the field to 0.
  • Every time you trigger the event, increment the value prior to event trigger and use that field in the body of the notification.

Hope this helps.



Thank-you!


Hello Nishant,


I really appreciate your approach, I have two notification triggering, depending on the same field i.e., 1st notification to user(creater of the incident) and 2nd notification to user and his manager( this notification   needs to be recurring until the field value changes){this is where I need the count in the body}.


We can not do the way you proposed.


Any further help is appreciated.


So, to understand better -


n=counter; (Default = 0)


n=1 - Notification to User (creator of incident)


n=2 - Notification to User and Manager


n=3 - Notification to User



You can use if conditions or Switch statements to drive what notification to trigger.