Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Mass email communication to clients/users using ServiceNow.

faisal_dadabhoy
Giga Expert

Hello,

I am just wondering if anyone is utilizing mass email communication to send emails from ServiceNow? As you know ServiceNow has a build in email functionality but does not have a feature to send mass emails so this would be a custom development? In my experience when mass emails are send about outages/changes it is based on datacenter, customers, clusters and etc.

 

High overview of development approach?

Pro/cons?

Any help/feedback will be appreciated?

Thanks, Faisal

29 REPLIES 29

Great Work. 

Daniel Draes
ServiceNow Employee
ServiceNow Employee

You might also want to look at the baseline plugin Targeted Communications.

This comes as part of our CSM Suite.

 

This is a fantastic tool and works great. We were looking for a solution and a standard for all communication with our internal customers and that would normally come from email i.e. Outages, General Information, User Registrations, SPAM/Malicious email warnings to ensure that all communications come from a central place rather than individual staff members.

faisal_dadabhoy
Giga Expert

On the update set, I was asked how to turn off Unsubscribe feature. Here are the instruction.

1. There is an email script: mass.email.notif.email (replace with below listed new script)

nav_to.do?uri=%2Fsys_script_email.do%3Fsys_id%3Dc948b8d80fa732008fb48d8ce1050e04%26sysparm_record_target%3Dsys_script_email%26sysparm_record_row%3D1%26sysparm_record_rows%3D42%26sysparm_record_list%3DORDERBYDESCsys_created_on

//New mail Script Start

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

//Instance Email Address Property
var instanceEmail = gs.getProperty('instance_name') + '@service-now.com';
//Unsubscribe Message Property
var unsubscribeMessage = gs.getProperty('mass.email.unsubscribe.message');
//Unsubscribe Message body Property
var unsubscribeBody = gs.getProperty('mass.email.unsubscribe.body');

//Adding Unsubscribe Link
//var toEmail = '<p>' + unsubscribeMessage + '<a href="mailto:'+ instanceEmail +'?subject=mass.communication.unsubscribe&body='+ unsubscribeBody.replace(/\s+/g, '%20') +'"target="_top">click here</a></p>';

//Set subject and body from mass communication tool
var massEmailSysid = event.parm1;
var grOverrite = new GlideRecord('u_mass_email_comm');
grOverrite.addQuery('sys_id', massEmailSysid);
grOverrite.query();
if (grOverrite.next()) {
email.setSubject(grOverrite.u_email_subject);
email.setBody(grOverrite.u_email_message);
}

//Property of email address to Process per Notification
var numEmailNotif = gs.getProperty('number.of.email.per.notification');

//Process Email Notifications
var rec = new GlideRecord('u_recipients_status');
rec.addQuery('u_mass_email', massEmailSysid);
rec.addQuery('u_status','Preview');

//If bluck email property is not set (or not set correctly). Process all emails at once
if ((numEmailNotif != "" || numEmailNotif != null) && numEmailNotif > 1 && numEmailNotif != undefined && isNaN(numEmailNotif) == false) {
rec.setLimit(numEmailNotif);
}
rec.query();
while (rec.next()) {
//email.addAddress("cc", rec.u_email_address);
email.addAddress("bcc", rec.u_email_address);
rec.u_status = 'Sent';
rec.update();
}
// Add your code here
})(current, template, email, email_action, event);

//Script End

2. Inactive or delete inbound email script, since unsubscribe is not being used.

nav_to.do?uri=%2Fsysevent_in_email_action_list.do%3Fsysparm_userpref_module%3D3cce245ac611227a01b51db7d30cb3d6%26sysparm_clear_stack%3Dtrue%26sysparm_clear_stack%3Dtrue%26sysparm_clear_stack%3Dtrue%26sysparm_clear_stack%3Dtrue

Thanks, Faisal

 

 

bacerott
Kilo Contributor

Is there any way to set a schedule for this type of Mass email notification? This is a great Update Set and I think my company will benefit from it tracking outages and information.