Inject here please!
For some customers it could be useful to pre-attach attachments of the record to mails sent from the email client. Or perhaps automatically attach a document like terms of service. The email client has the wonderful ability to do this by preloading the attachments of the email record. Imagine the following scenario: A client needs to be able to automatically send all existing attachments of the record with every email. This includes the notifications sent through via the email client. You can make that happen.

Adding a business rule

Every time the notification icon is pressed (the little envelop in the top form bar ), and the email client is loaded, a record in the sys_email table is created. To attach any documents from the attachment table to any email from the client, ServiceNow will create an attachment record for that particular sys_email record and make a connection between them. Knowing this, you can use this feature by creating a before business rule that adds attachments to the sys_email record on insertion. So create the following business rule on sys_email:

// get the hasmap from the GlideURI
var map = gs.action.getGlideURI().getMap();
var table = map.get(‘sysparm_table’);
var sid = map.get(‘sysparm_sys_id’);

if (!table.nil() && !sid.nil()) {
    // copy the attachments from the “source” incident, sid, current.getTableName(), current.sys_id);
} catch (err){}

With some gratitude towards a contributor on the community forums (, you are able to attach stuff quite easily. The package method being called copies existing attachments to records. The GlideURI is a way of sending parameters and thereby actions through the system. In this case, it contains enough data to copy attachments to email client emails.

When you now add attachments to the record and open the email client, the email will automatically contain the attachments. Sounds easy enough, but…..
Continue reading…»