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

n=counter; (Default = 0)


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


n=2 - Notification to User and Manager(notification 1)


here, i wrote a rollback function i workflow to check for the status (catageory field, untill unless it changes the notification should continue firing,)


n=3 - Notification to User and manager (saying notification 2)


n=4 - Notification to User and manager (saying notification 3)


Makes sense but ccan you make it a bit clear.


You can use the same logic - But, in the notification use it as (n-1).



notificationCounter = 0;


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


notificationCounter = 2 - Notification to User and Manager(notification 1 = (notificationCounter-1))


here, i wrote a rollback function i workflow to check for the status (catageory field, untill unless it changes the notification should continue firing,)


notificationCounter = 3 - Notification to User and manager (saying notification 2 = (notificationCounter-1))


notificationCounter = 4 - Notification to User and manager (saying notification 3 = (notificationCounter-1))



Makes better sense?


Saikiran Gudur1
Mega Guru

Hi Srikanth, using a scratchpad variable is a good approach to this as per me. I can understand that for every turn you have to send two notifications one for manager and other for user. There will be a different key in the subject line for the user mail and manager mail when a notification is triggered, I believe. So we can store two scratchpad variables one for managerMailCounter , userMailCounter, and you can use the subject key in if condition to conditionally update the two counters and use others suggestion to make it fulfilled


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..