How to add a custom banner to all outbound email notifications?

Laurie Marlowe1
Kilo Sage

Hello,

Is there a way to add a banner image to all outbound emails, without having to add it manually to each email notification?

Thanks,

Laurie

 

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

You can use a Before Insert/Update Business Rule to accomplish that:

find_real_file.png

 

The Script would be:

(function executeRule(current, previous) {
	//add a note to the top of the message with a customizable Message record
	var prefixMessage = gs.getMessage("u_notification_prefix").replace("u_notification_prefix", "");
	//update the current email message
	current.body = prefixMessage + current.getValue("body");

})(current, previous);

 

I actually use a Message record to control the contents of the prefix:

find_real_file.png

The Message field can contain whatever HTML you might need.  You can also just put it into the Business Rule if you would rather keep everything together.  I use the Message record because I have a prefix and suffix and a few other things in the Business Rule.  I just included a simplified version of the BR above.

So that BR will now include the prefix into every single email that goes out of your instance.

View solution in original post

11 REPLIES 11

Prateek kumar
Mega Sage

We can try something like a background script.

Create a notification email script.

Loop thru email notifications and include the email notification script at the end?

Proceed with caution, untested.

var noti = new GlideRecord('sysevent_email_action');
noti.query();
while (noti.next()) {
	var gr = new GlideRecord('sys_script_email');
	gr.addQuery('sys_id', 'Newly created notification script');
	gr.query();
	if(gr.next()){
	noti.message_html = noti.message_html+'\n'+'${mail_script:'+gr.name+'}';
        noti.setWorkFlow(false);
        noti.autoSysFields(false);
        noti.update();
	}

}

Please mark my response as correct and helpful if it helped solved your question.
-Thanks

I was hoping there was a property oob, or something I was missing!

I wish there would be an easy way.

Lets see if someone else has any idea


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Thank you.