I learned something new today while building out a few e-mail notifications. If you've been effectually Service-now for a while
you're probably familiar with the formatting of email notification messages. One of the common requirements for outgoing email notifications is to include a link to the originating record or task in the email. Doing this makes it easy for finish users to return to the record that they need to work on. There are a couple of unproblematic means to include these links in the torso of an electronic mail notification in Service-now. One fashion I've known about for a long time, the other way I just discovered.


The first way to add a link to a record in an outgoing email is to use the ${URI} shortcut anywhere in the body of your email notification. Using this method produces a link in your electronic mail that looks similar this…

While the ${URI} method works great for well-nigh cases, you tin't exercise anything to modify the outgoing link. All of the links generated with this method will be formatted exactly equally shown with the word 'LINK' in capital messages. The second method gives you an culling to this static 'LINK' link.
You tin can invoke this shortcut by using ${URI_REF} anywhere in the torso of your electronic mail notification. Using ${URI_REF} takes the display value for the linked record and uses that for the link text instead of the word 'LINK'.

Information technology is also possible to drill through to a related record and notice the link for that tape. For instance, if I were sending out an email notification from an approving tape and I wanted to add together a link for the corresponding task to be canonical, I could add information technology like this…
${sysapproval.URI_REF}

If neither of these ways suits your needs, it is e'er possible to create your ain link to whatsoever tape you need to link to. Since the email link is just HTML you just demand to provide the right URL and wrap it in the correct HTML tag. Hither's a sample function I got from the forums that takes a tabular array name and tape sys_id value equally inputs and returns a formatted link based on the information provided.

<mail_script>
var tbl = current.getTableName ( ) ;
var sysID = current.sys_id ;
var link = createLinkForObject(tbl,sysID) ;
template.impress (link) ;
office createLinkForObject(strTableName, strSysID) {
return '<a href="' + gs.getProperty ( 'glide.servlet.uri' ) + gs.generateURL (strTableName, strSysID) + '">LINK TEXT Here</a>' ;
}
</mail_script>