Send One Notification with Three Different Subjects

Mark Wood
Tera Contributor

Hello Experts,

I have a catalog item with a variable called "reason for replacement." If the reason for replacement is "broken," I want to send a notification with the subject "Broken." If it's "lost," I want to send a notification with the subject "Lost," and if it's "upgrade," I want to send a notification with the subject "Upgrade." The content of the notification remains the same for all three reasons, but I don't want to create three separate notifications. Instead, I want to manage all of this within a single notification. Could someone please guide me on how to achieve this?

Thank You.

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @Mark Wood ,

Your can configure the subject line in email object via email script and use this email script in notification.

Also u can check if that variable can be added in subject line via dot walking.

-Thanks,

AshishKM

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Sohail Khilji
Kilo Patron
Kilo Patron

 

try this :

 

 

 create mail script named setSubject as below example :

 

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

	if(current.variable=='lost') 
		{
			email.setSubject('The item is Lost ');
		}
	else if (current.my_variable=='broken') 
		{
			email.setSubject('The item is broken ');
		}
       else if (current.my_variable=='upgrade') 
		{
			email.setSubject('The item is upgraded ');
		}
		

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

 

 

Call the mail script in the notification body in format

${mail_script:setSubject}

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect