How to add URL link to email notification?

Radhika11
Tera Contributor

Hello,

I came across a enormous posted on the web on how to add link to email notification.  I have tried more then 3, but I could not get it to work. Could someone please help?  Thanks

find_real_file.png 

13 REPLIES 13

@Ankur Bawiskar 

I have tested the following and all returned record not found:

find_real_file.png

Hi,

you need to use email script for this

Create email script and add to email body

${mail_script:mailScriptName}

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

          // Add your code here
	var gr = new GlideRecord("kb_knowledge");
	gr.addQuery("source", current.getUniqueValue());
	gr.query();
	if (gr.next()) {
		var link = '<a href="' + gs.getProperty('glide.servlet.uri') + 'kb_knowledge.do?sys_id=' + gr.sys_id + '">' + gr.getValue('number') +'</a>';
		template.print(link);
	}

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

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Radhika 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

jinwei wang2
Giga Contributor

how to notiification link to native UI