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.

Add record link in email notification (portal link)

Tapish Sharma
Tera Contributor

I am trying to add the link to record in portal, nut it doesnt seem to work.

find_real_file.png

1 ACCEPTED SOLUTION

_ChrisHelming
Tera Guru

Remove the single quote with the red underline. You're ending your string by having that quote there, and https isn't a variable so it needs to be within your quoted string.

View solution in original post

4 REPLIES 4

Krupamayee
Kilo Expert

Please use the below code in your email script:

 

var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&sys_id=' + current.sys_id + '">Link</a>';
template.print(url);

 Please mark helpful,if it resolved your issue

-Krupa.

wrong portal and relative url based on their example but `gs.getProperty('glide.servlet.uri')` is better than using `'https://' + gs.getProperty('instance_name') + '.service-now.com'` since the latter assumes they're not using a custom URL.

_ChrisHelming
Tera Guru

Remove the single quote with the red underline. You're ending your string by having that quote there, and https isn't a variable so it needs to be within your quoted string.

Saurav11
Kilo Patron
Kilo Patron

Hello,

Please use the below link:-

var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&view=sp'+'&sys_id=' + current.sys_id + '">${parent.number}</a>';

template.print(url);

 

Please mark the answer correct/helpful based on impact