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

J Siva
Tera Sage

Hi @Shivangi Singh2 

No need to create three different notifications/templates. Instead, you can pass the values via event parameters and use them in your notifications/email templates.

I believe you are using a flow/workflow to trigger notifications. Whenever you fire the event, simply pass the string message you want to use in the body or subject

 

Ex: 

gs.eventQueue('<event registry>',Glide object record,'String you want to pass (i.e., Reminder 1)')

Hope this helps.
Regards,
Siva

Hi @J Siva ,

Thank you for the solution , but I am using flow designer and Fire event OOB action . both parm1 and parm2 are already used .

But let's say i want to make modification in one of these , how can i access it and modify my email with it .

Can you please help me with any sample code ?

@Shivangi Singh2 
Could you share the information on what you are passing through param1 and param2?

Sure.

In Param 1 - sysid of RITM

In Param 2- Approver