

- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Though User table is base for all User records in ServiceNow the information always differs & which should. We have scenarios where multiple company's User records are created as per business requirements. One such situation would be 2 companies getting merged so as to provide solution from single ServiceNow instance which means some standardtization needs to be in place in terms of process, modules, etc. But one such thing companies want to be different is to have their company specific logo maintainted & to be used in the notifications being sent out & also in the banner (ServiceNow backend). This may be & can be considered a valid requirement which business may demand & is very simple to implement by following steps below.
1. Upload Company's logo in Image table with appropriate name.
2. Update the Image in Companies table for valid company record in Banner image field.
3. Create a mail script (for notifications to dynamically embed company's logo as & when triggered).
Since, Step 1 is just upload of image with valid name it is simple & does not require a detailed explanation.
2. Update the image in Companies table for valid company record.
Look for company record from User Administration >> Companies & update the image in Banner image field of the Company form. Whole purpose of getting the image updated in the Banner image field is ServiceNow OOB takes care of the image to be displayed when the User logs in as the banner image which can also be leveraged for the notifications to dynamically populate the image.
So, in our case if Company A's User logs in Company A's image will be displayed in the banner area of ServiceNow instance & vice-versa for other Company's Users when they log in.
3. Create a mail script (for notifications to dynamically embed company's logo as & when triggered).
Mail Scipt: pick_company_image
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
//Checks if current table is incident
var usrcomp=current.caller_id.company;//gets company from current record
var chkcomp=new GlideRecord('core_company');
chkcomp.addQuery('sys_id',usrcomp);
chkcomp.query();
while(chkcomp.next())
{
var imgis=chkcomp.banner_image;
if(imgis=='') //if there is no image display default
{
template.print('<img src="ITS1.png" width="272" height="61"/>');//replace ITS1.png with some default image from image table
}
else
{
template.print('<img src="' + imgis + '" />');
}
}
})(current, template, email, email_action, event);
Once, done you need to call the mail script in the notification where you want records to be dynamically have company's logo displayed when notifications are sent. To call mail script include below in the notification body.
${mail_script:pick_company_image}
Note: The above mail script will work only for incidents as in the code above we are looking for caller_id's company which may be a field only on incidents. If it is to be used for RITMs then caller_id field from the above script will have to be replaced with requested_for or any other appropriate field.
Hope it helps. Cheers!!
Thanks,
Jaspal Singh
- 2,859 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.