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

JonathanJacob
Mega Sage

you can use a mail script with something like this....



url = gs.getProperty('glide.servlet.uri') + gs.generateURL(current.sys_class_name, current.sys_id);
template.print("<a href='" + url + "'>" + current.number + "</a>");


also you can use this via glide record:
https://wiki.servicenow.com/index.php?title=GlideRecord#getLink


Hi Jonathan,

Thanks for the response. I get the same result. The URL starts with /grc_policy.do. If I add the missing part of the URL to the string, it doubles it.

Take care, Jim





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




Hi Phillip,



Here's what I get with this script:





I think I need to play around with the number part, but the initial problem is still there.



Thanks, Jim