Send Reminder approval emails for a particulat catalog item

Shivangi Singh2
Tera Contributor

My question is if I have to send lets say 3 reminder email for a particular RITM until it is approved , do i have to create 3 different notifications stating Reminder 1,2,3?

in the body or subject line we would like to add that it's a reminder email but i am not sure if there's any way where i can utilize current notification for reminder purpose also ,or do i have to create different template for all 3 reminders?

2 ACCEPTED SOLUTIONS

@Shivangi Singh2 
In the param 1 or param 2, pass the stringified JSON objects.

{
  "approver": "Approver detais",
  "subject": "Reminder 1"
}

 

Then in your email script, parse the JSON and use it as required.

var obj = JSON.parse(event.param2);
var approver = obj.approver;
var subject = obj.subject;

View solution in original post

Robert H
Mega Sage

Hello @Shivangi Singh2 ,

 

You only need a single Notification. You can pass the reminder number as a parameter and then based on whether it's 1, 2 or 3 you can have different subjects or messages in the email.

 

Example:

Create an Email Script, e.g. "my.approval.reminder":

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {


	var parameters = JSON.parse(event.parm1);
	var reminderNumber = parameters.reminderNumber;
	email.subject = 'Reminder #' + reminderNumber;

	if (reminderNumber === 1) {
		template.print('This is the first reminder.');
	}

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

 

Include the above Email Script in the Message field of the Notification:

${mail_script:my.approval.reminder}

 

Then trigger the event that triggers the above Notification like this:

var parameters = {
	ritmSysId: '...',
	reminderNumber: 1
};
var approverSysId = '...';

gs.eventQueue('my.approval.reminder', current, JSON.stringify(parameters), approverSysId);

 

Regards,

Robert

View solution in original post

10 REPLIES 10

Shivangi Singh2
Tera Contributor

Thank you all for the help!!