logo

NJP

How to add photo of 'Assigned to' onto email notification

Import · Feb 10, 2019 · article

1. Create a Notification Email Script:

image

attachPhoto();
function attachPhoto() {
    //Check if current assigned to user has a photo.
    var gr = new GlideRecord('sys_user');
    gr.addQuery('name',current.assigned_to.name);
    gr.query();
    if (gr.hasNext()) {
        while (gr.next()) {
            var photo = '<img src="' + gr.photo.getDisplayValue()+  '">';
            template.print(photo +  "<br />");
        }
    }
}

2. You can then use the above script in any notification which has access to the 'assigned to' field by adding this line in the notification: ${mail_script:add_assigned_to_photo}

View original source

https://www.servicenow.com/community/developer-articles/how-to-add-photo-of-assigned-to-onto-email-notification/ta-p/2330241