This is a big part of my servicenow development, I have referenced from a lot WIKI article as well as QAs. Now I want to share it with.

1. Step one, add signature field into sys_user table. and we can upload some pictures for some user for test purpose, i.e. test manager and test director.

2. Step two. create your workflow, lets say it need two approvals, including test manager and test director, which means they are ok to put their scanned signature into the email notification to whoever it send to.

3. Service Include Script:

var LeiLib = Class.create();
LeiLib.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	initialize: function(){
	},
getSign : function(userid)
	{
		var output="";
		var user = new GlideRecord("sys_user");
		user.addQuery("sys_id",userid);
		user.query();
		while(user.next())
			{
				output="<img src=\""+user.getDisplayValue("u_signature")+"\">";
		}
		return output;
		
	},
getSignTable:function()
{
	var output="";
	var gr = new GlideRecord("sc_task");
	gr.addQuery("request_item",current.sys_id);
	gr.query();
	while(gr.next()) {
		output+=("<table style=\"width:800px;border:solid black 1px\">");
		output+=("<tr style=\"background-color:#f5f5f5\" ><td style=\"width:100px;border:solid black 1px\">BU Manager Sign</td>");
		output+=("<td style=\"width:300px;border:solid black 1px\">"+this.getSign(gr.u_bu_manager)+"</td>");
		output+=("<td style=\"width:100px;border:solid black 1px\">Finance Manager Sign</td>");
		output+=("<td style=\"width:300px;border:solid black 1px\">"+this.getSign(gr.u_finance_manager)+"</td></tr>");
		output+="</table>";
	}
	return output;
},
	
	type: 'LeiLib'
});

 3. Now you just need to creat a email notification script (i.e. "getSignatureTable") to call this function. And it will draw a table with both signatures into the email.

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
	(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
	
	var foo = new LeiLib();
	var output="";
	output+=("get SignTable </br>");
    output+=foo.getSignTable();
template.print(output);

	
})(current, template, email, email_action, event);

          // Add your code here

})(current, template, email, email_action, event);

 4. Include this email notification script into email notification workflow activity, as:

${mail_script:getSignatureTable}

 

About Lei

I am an IT specialist with over 10 year experience - years on Automation, on-Premise or Azure.

I am happy to develop however never want be a full time developer. Only do what I have to do. If it has to be PowerShell,HTML, PHP, CSS, C#, VBS or JS, front end or backend, so be it, doesn't matter!

Spent years with Windows, SCCM, SharePoint, SQL and Exchange servers. For last several years, I have been actively working under On Premise > Azure environment.

THERE IS NO WAY BACK!!!

Current Certificates:
    Microsoft® Certified-
  • -Enterprise Administrator
  • -Database Administrator
  • -SharePoint Administrator
  • -Administering and Deploying SCCM 2012
Red Hat Certified Technician
ITIL V3 Foundation - Practitioner

Working on Azure Certificates now and hopefully they can stop upgrading their questions one day! GIVE ME A BREAK!

Contact Lei

Name *
Email *
Comments *

Traffic since 10/08/2016

Today13
Yesterday83
This week637
This month1933
Total416293

Visitor Info

  • IP: 54.221.73.186
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

1
Online

2017-12-17

Login