Single notification with multiple mail content help

Community Alums
Not applicable

Hiii,

I have requirement to create one notification and trigger multiple content mails based on some conditions.

ex: once request created there is a mail going with request has been created. so in same notification i want to change the content only for one catalog item, means for abc item, different content mail should trigger.

how can we achieve this.

Regards,

Roopa

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

you can trigger the notification based on condition as well you can add the condition in email script . 

adding sample Email script here. 

 

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

          // Add your code here
	if(current.state==1){
		email.setSubject('Hi Good Morning !!');
		template.print('Welcome To Servicenow' + "<br/> State: " + current.state.getDisplayValue());



	}
	else{
		email.setSubject('Hi Good Night !!');
		template.print('Welcome To Servicenow Community' + "<br/> State: " + current.state.getDisplayValue());
	}
	

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

 

Note: here what i did, if my RITM state is open then notification will trigger with good morning subject else it will set the email subject good night. you can make some modification in email script based on your need. 

 

 

View solution in original post

9 REPLIES 9

Jagadeesh R1
Tera Expert

Hello,

     I think you can achieve this by email scripts. You can set different email content based on the catalog item in notification email scripts. 

 

Regards,

Jagadeesh

Community Alums
Not applicable

Thanks Jagadeesh for reply..

 

Not getting how to start with it. can u please help if u have done the same.

 

Sure.. Could you please confirm if you are using OOB notification which sends emails to all the requests raised? If the notification content has to be changed for one catalog item alone, we can find a much better solution

Community Alums
Not applicable

yes ,OOB notification