Sending a clickable link with the Email Navigation Add-on link

jmuomini
Mega Expert

Hi,

I'm trying to customize an email client template for kb_knowledge to send a clickable link with the Email navigation link from kb_home. I've tried ${URI} and ${URI_REF}, but these put in long, ugly URLs that aren't clickable. I've also added a URL calculation field to my kb_knowledge form, but when I put this field on my template with


<a href="${u_url}" target="_blank">${number}</a>

the emailed link is truncated to:


<a href="/kb_view.do?sysparm_article=KB10090" target="_blank">KB10090</a>.

If I then add the missing part of the URL:


<a href="https://usfdev.service-now${u_url}" target="_blank">${number}</a>


I end up with duplication:


<a href="https://usfdev.service-nowhttps//usfdev.service-now.com/kb_view.do?sysparm_article=KB10090" target="_blank">KB10090</a>


Any suggestions on how to get a simple clickable link from a KB article in an email client template?

Thanks, Jim
1 ACCEPTED SOLUTION

jmuomini
Mega Expert

Thanks to some deep digging by Sam Polk at the SNOW Help Desk with an assist from Cesar Sandoval, I have an answer at last to why my email URLs were being truncated and none on the rest of you were seeing this.

About a year ago I followed a tip to change the body field type on sys_email from String to HTML. This allows you to use the TinyMCE HTML editor in the email client. The unintended consequence is that full URLs links are changed to relative URL links during the process of changing the sys_email body text from plain text to HTML, according to Sam.

Thanks to Sam, Cesar and all who tried to help me.

Jim


View solution in original post

25 REPLIES 25

Hello Jim,

Great timing on the subject. Tim's suggestion was just missing the {} around the current.number so try that first. If that does not do it then another item that might help using Tim's approach

I have the same need to send a link to view the article and I have another kicker with Single Sign on. So one of the things you do with SSO is to add another glide value to perform email overrides. The following wiki article talks about how do set it up (Look for Section 6 Email Links with SSO)

http://wiki.servicenow.com/index.php?title=External_Authentication_(Single_Sign-On_-_SSO)

Anyway the glide value looks like this
glide.email.override.url = 'https://instance name/nav_to.do'

So I took the code provided above and did modified it and it seems to work. It does not appear your are using SSO but I think the concepts will help explain how to build the link and tweak to your needs.



template.print('<a href="' + gs.getProperty("glide.email.override.url") + '?uri=kb_view.do?sys_kb_id=' + '${current.number}">KB Article</a>');


Good luck


Hi Mark,

This is close. Now I'm getting:

https://usf.service-now.com/null?uri=kb_view.do?sys_kb_id=KB10152.

Note the null after the instance.

We are using SSO, but the articles I'm trying to link to are public.

Thanks, Jim


Jim,

A couple of different things to try since the knowledge is a public article.

First remove the ?uri from the text '?uri=kb_view.do?sys_kb_id='. What that does is hold the web site during the SSO procedures until authentication completes and in this case you are not using SSO.

Also check the value in the Property glide.servlet.uri and make sure there is not a carriage return at the end of value. I had that (hard to see) and it would cause a null response in my hyperlink.

Hope this works


JonathanJacob
Mega Sage

Hi Jim,

Can you post the code here from your notification?


Hi Jonathan,

I worked with a SNOW SE today and here's what we came up with:



<mail_script>
var url = "https://usfdev.service-now.com/kb_view.do?sysparm_article=" + current.number
template.print("<a href="+ url + ">" + current.number + "</a>");
</mail_script>


Thanks, Jim