Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

hyperlink to instance in Email script

Aditya2
Kilo Expert

Hi 

I'm having a requirement where I have to display a hyperlink on email notification. That link should guide user to knowledge article present in the instance. The link to the article is present in a property. The link must work independant of instance. 

Thanks in Advance

1 ACCEPTED SOLUTION

Sourabh26
Giga Guru

Hi,

 

Use below login as per requirement.

 



Get Instance Name - 
var instName = gs.getProperty("instance_name");

Get KB Article link - 
var kbArticle = gs.getProperty("your_property_name");


template.print('<a href="https://' + instName + '.service-now.com/' + kbArticle + '</a>');

Please mark the answer as correct/helpful based on impact.

Regards,

Sourabh

View solution in original post

3 REPLIES 3

Ankur Swami
Tera Guru

Hi,

 

You can create the link from followed by the below line of code:

 

template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=incident.do?sys_id=' + gr.sys_id + '">' + gr.number + '</a>');

 

gs.getProperty('instance_name') gives you the current instance name.

 

Please mark correct answer if it helps.

 

Thanks,

Ankur

Saurav11
Kilo Patron
Kilo Patron

Hello,

You can use this below for Incident.. you can customize as per your requirement this below link. I used this in current Jakarta version and it works. 

 

template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=incident.do?sys_id=' + gr.sys_id + '">' + gr.number + '</a>');

Hope this helps. Please mark the answer as correct/helpful based on impact.

Sourabh26
Giga Guru

Hi,

 

Use below login as per requirement.

 



Get Instance Name - 
var instName = gs.getProperty("instance_name");

Get KB Article link - 
var kbArticle = gs.getProperty("your_property_name");


template.print('<a href="https://' + instName + '.service-now.com/' + kbArticle + '</a>');

Please mark the answer as correct/helpful based on impact.

Regards,

Sourabh