<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Knowledge article dynamic linking in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434007#M90933</link>
    <description>&lt;P&gt;So this is a problem I'm dead certain someone else has had to tackle and answer. I'm importing and converting a very well-written and maintained knowledgebase. Images, videos, all of that is tackled, but what I can't seem to puzzle out is links between KB articles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a lot of them, and the problem isn't as straightforward as it might at first appear. The way I see it, I've got two hurdles I need to overcome: Versioning and Service Portal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Versioning, by itself, is not insurmountable. The system itself provides a way, here: links that use the KB number.&lt;/P&gt;&lt;P&gt;&lt;A href="https://dev44111.service-now.com/kb_view.do?sysparm_article=KB0000030" title="https://dev44111.service-now.com/kb_view.do?sysparm_article=KB0000030"&gt;https://&amp;lt;instance&amp;gt;.service-now.com/kb_view.do?sysparm_article=KB0000030&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Which, awesome, this will always link to the latest version of the article. But when you throw Service Portal into the mix, it falls apart for a few reasons:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Service Portal recognizes &lt;A href="https://dev44111.service-now.com/sp/kb_view.do?sysparm_article=KB0000030" title="https://dev44111.service-now.com/sp/kb_view.do?sysparm_article=KB0000030"&gt;https://&amp;lt;instance&amp;gt;.service-now.com/sp/kb_view.do?sysparm_article=KB0000030&lt;/A&gt; well enough, but it does so by stripping out the /sp/ and loading the kb article in the default ITIL view. This won't work for us; we need to preserve the SP branding and nagivation bars.&lt;/LI&gt;&lt;LI&gt;No matter how an article is called, the url displayed is always in this format: &amp;nbsp; service-now.com/sp?id=kb_article&amp;amp;sys_id=d15de43187032100deddb882a2e3ec7d&lt;BR /&gt;This makes linking the latest article from a web browser just about impossible.&lt;/LI&gt;&lt;LI&gt;The links &lt;EM&gt;in the article itself &lt;/EM&gt;won't work properly. Instead of sending the user to the Service Portal view of the article, the link will send them to the unadulterated (no navigation menus or other kibble) link in the full application view. This is undersable because we don't want end users in the itil view at all, and if they somehow get there showing them zero context is jarring and unhelpful at best.&lt;/LI&gt;&lt;LI&gt;If I were to include all of these links, somehow, in a way that worked for Service Portal, now I have the issue where I'm breaking the ITIL users if they try to browse articles and forcing them out into Service Portal. This is also less than ideal.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, to recap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, the kb_view.do? method of linking articles works to counteract the versioning problem. But Service Portal vs ITIL is still an issue that I don't see an easy way around. So my question is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Is there a way to configure kb_view.do or create my own custom linking mechanism?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;If I do so, does anyone have a recommendation on programming it to detect if the user is on SP/Full view?&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help or suggestions you might have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE: Having unsucessfully tried modifying the UI page and creating a processor to intercept the kb_view references, I'm starting to think that I need to disable the html sanitizer on the knowledge text view and use a javascript onclick for routing... It's either that or own both the SP widget and the UI Page for displaying knowledge articles. I hate to mess with the sanitizer, but my options are looking a little thin at the moment.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2018 22:09:55 GMT</pubDate>
    <dc:creator>Beth11</dc:creator>
    <dc:date>2018-02-05T22:09:55Z</dc:date>
    <item>
      <title>Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434007#M90933</link>
      <description>&lt;P&gt;So this is a problem I'm dead certain someone else has had to tackle and answer. I'm importing and converting a very well-written and maintained knowledgebase. Images, videos, all of that is tackled, but what I can't seem to puzzle out is links between KB articles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a lot of them, and the problem isn't as straightforward as it might at first appear. The way I see it, I've got two hurdles I need to overcome: Versioning and Service Portal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Versioning, by itself, is not insurmountable. The system itself provides a way, here: links that use the KB number.&lt;/P&gt;&lt;P&gt;&lt;A href="https://dev44111.service-now.com/kb_view.do?sysparm_article=KB0000030" title="https://dev44111.service-now.com/kb_view.do?sysparm_article=KB0000030"&gt;https://&amp;lt;instance&amp;gt;.service-now.com/kb_view.do?sysparm_article=KB0000030&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Which, awesome, this will always link to the latest version of the article. But when you throw Service Portal into the mix, it falls apart for a few reasons:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Service Portal recognizes &lt;A href="https://dev44111.service-now.com/sp/kb_view.do?sysparm_article=KB0000030" title="https://dev44111.service-now.com/sp/kb_view.do?sysparm_article=KB0000030"&gt;https://&amp;lt;instance&amp;gt;.service-now.com/sp/kb_view.do?sysparm_article=KB0000030&lt;/A&gt; well enough, but it does so by stripping out the /sp/ and loading the kb article in the default ITIL view. This won't work for us; we need to preserve the SP branding and nagivation bars.&lt;/LI&gt;&lt;LI&gt;No matter how an article is called, the url displayed is always in this format: &amp;nbsp; service-now.com/sp?id=kb_article&amp;amp;sys_id=d15de43187032100deddb882a2e3ec7d&lt;BR /&gt;This makes linking the latest article from a web browser just about impossible.&lt;/LI&gt;&lt;LI&gt;The links &lt;EM&gt;in the article itself &lt;/EM&gt;won't work properly. Instead of sending the user to the Service Portal view of the article, the link will send them to the unadulterated (no navigation menus or other kibble) link in the full application view. This is undersable because we don't want end users in the itil view at all, and if they somehow get there showing them zero context is jarring and unhelpful at best.&lt;/LI&gt;&lt;LI&gt;If I were to include all of these links, somehow, in a way that worked for Service Portal, now I have the issue where I'm breaking the ITIL users if they try to browse articles and forcing them out into Service Portal. This is also less than ideal.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, to recap:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, the kb_view.do? method of linking articles works to counteract the versioning problem. But Service Portal vs ITIL is still an issue that I don't see an easy way around. So my question is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Is there a way to configure kb_view.do or create my own custom linking mechanism?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;If I do so, does anyone have a recommendation on programming it to detect if the user is on SP/Full view?&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help or suggestions you might have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE: Having unsucessfully tried modifying the UI page and creating a processor to intercept the kb_view references, I'm starting to think that I need to disable the html sanitizer on the knowledge text view and use a javascript onclick for routing... It's either that or own both the SP widget and the UI Page for displaying knowledge articles. I hate to mess with the sanitizer, but my options are looking a little thin at the moment.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 22:09:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434007#M90933</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2018-02-05T22:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434008#M90934</link>
      <description>&lt;P&gt;Because your KB Articles all link to other articles with the URL formatted as you have stated, I think you will have to build your solution into the "kb_view" UI Page. You should be able to write a g:evaluate script at the top that will determine if the URL is a service portal URL, and then use the KB_article parameter of the URL to do a gliderecord query search of the kb_knowledge table finding the latest version of the article with that number, and then format a URL that is service portal formatted and redirect from there.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2018 23:04:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434008#M90934</guid>
      <dc:creator>Jon Barnes</dc:creator>
      <dc:date>2018-02-05T23:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434009#M90935</link>
      <description>&lt;P&gt;That... might work, actually. I was going down the processors route, and while I think that would eventually work getting the referring URL was proving to be a real pain. Let me try it this way and see how it looks.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks for setting me on a path, I'll update with what I find out.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2018 23:21:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434009#M90935</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2018-02-05T23:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434010#M90936</link>
      <description>&lt;P&gt;With a little more research, I've hit a somewhat silly stumbling block. I tried dropping a kb_view link into the body of a test article. I can click on it all right and it does as expected (take me to the itil view.) I put a quick &amp;lt;script&amp;gt; into the kb_view UI page and had it write out document.referrer, and it doesn't seem to be preserving the actual reference: it's spitting out the exact address of the link (so the current url, not the referring one).&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I took a stab at some other methods for getting the referring URL, but RP.getReferringURL() in the g:evaluate tag seems to have the same problem. I even cast futher afield and tried&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="_jivemacro_uid_15178756043486595 jive_macro_code jive_text_macro" data-renderedposition="134_8_1192_32" jivemacro_uid="_15178756043486595"&gt;&lt;P&gt;var tr = new GlideTransaction.get();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gs.log("second try " + tr.getRequest().getRequestURL(),"kb_view_2");&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;But this also returned the new URL:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="_jivemacro_uid_15178756156174632 jive_macro_code jive_text_macro" data-renderedposition="229_8_1192_17" jivemacro_uid="_15178756156174632"&gt;&lt;P&gt;&lt;SPAN&gt;second try &lt;/SPAN&gt;&lt;A title="" _jive_internal="true" href="http://llnldev.service-now.com/kb_view2.do" rel="nofollow" target="_blank"&gt;http://llnldev.service-now.com/kb_view2.do&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;When the actual referring URL is: &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15178758495715193 jive_text_macro" data-renderedposition="309_8_1192_16" jivemacro_uid="_15178758495715193" modifiedtitle="true"&gt;&lt;P&gt;&lt;A href="https://llnldev.service-now.com/sp?id=kb_article&amp;amp;sys_id=bb18d1aadb4c1b801a9efd0e0f961967" title="https://llnldev.service-now.com/sp?id=kb_article&amp;amp;sys_id=bb18d1aadb4c1b801a9efd0e0f961967"&gt;https://&amp;lt;instance&amp;gt;.service-now.com/sp?id=kb_article&amp;amp;sys_id=bb18d1aadb4c1b801a9efd0e0f961967&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Any thoughts on how I can successfully determine if the kb is being viewed from the portal or not? I've done a bit in jelly but very little with service portal at this point, so I might just be missing something in my google searches.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Edit: added actual source URL for clarity.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Feb 2018 00:07:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434010#M90936</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2018-02-06T00:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434011#M90937</link>
      <description>&lt;P&gt;actually, yes, I was thinking about them being relative URLs, so thought the URL in getRequestURL() would have "sp" in it.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Ok, another direction you could go that may be more promising:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN&gt;You could clone the KB Article Page widget, and in the server script, after you set data.text to the content of the article, do a global replace of "&lt;/SPAN&gt;&lt;A title="k-external-small" class="jive-link-external-small" href="https://" rel="nofollow" target="_blank"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;instance&amp;gt;.service-now.com/kb_view.do?" with "?id=kb_article&amp;amp;". which should leave you with the URLs as "?id=kb_article&amp;amp;sysparm_article=KB0000030", which should take you where you want to go.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Then, you would also update the server script to allow sysparm_article parameter, and if that is passed in, find the latest article by that number instead of looking up by sys_id as it is now.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Finally, you will have to update the kb portal page to use your new widget.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Feb 2018 00:43:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434011#M90937</guid>
      <dc:creator>Jon Barnes</dc:creator>
      <dc:date>2018-02-06T00:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434012#M90938</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm also struggling with this - we use both the /sp and /hrportal and these do not work, i can't show anything but the backend version of the knowledge article using the url below:&lt;/P&gt;
&lt;P&gt;https://&amp;lt;instance&amp;gt;.service-now.com/kb_view.do?sysparm_article=KBXXXXX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried a number of iterations but they all show as error 404 or 'article not found'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone solved this on the portals?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Carl.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 22:05:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434012#M90938</guid>
      <dc:creator>Carl Fransen1</dc:creator>
      <dc:date>2018-05-23T22:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434013#M90939</link>
      <description>&lt;P&gt;Hi Carl,&lt;/P&gt;
&lt;P&gt;I ended up going with an iffy solution that involved a&amp;nbsp;fair bit of work to get going. In the end,&amp;nbsp;how you proceed is going to depend on how important it is to your &lt;EM&gt;end&amp;nbsp;users&lt;/EM&gt; to be able to view past article versions. If it isn't, here's what I would do:&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;Clone the existing knowledge content widget (I believe it's kb-article-content). From here you can either manipulate the date being fed in&amp;nbsp;&lt;STRONG&gt;populateParameters&lt;/STRONG&gt;() or point it at a new function in&amp;nbsp;KBViewModel.&lt;/LI&gt;&lt;LI&gt;In the populateParameters or the new function, Run two queries: one to get the&amp;nbsp;article passed by sys_id, and a second to get the latest version of that article.&lt;/LI&gt;&lt;LI&gt;Feed that article back the same way that&amp;nbsp;KBViewModel is intended to work.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;This might require some trial and error to make sure you're covering all of the URL types that you might see, particularly in articles that link to other articles. What we ended up doing was slightly more complex and involved making the page handle both sys_id and KB number, since that was an additional requirement, but if you don't have to do that there's no reason to complicate matters.&lt;/P&gt;
&lt;P&gt;Let me know if that's confusing and I'll try to clarify with some examples.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 23:44:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434013#M90939</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2018-06-21T23:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434014#M90940</link>
      <description>&lt;P&gt;We ended up overriding the default behavior in the knowledge content widget to check for the latest version before it retrieved the full KBViewModel widget.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 23:46:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434014#M90940</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2018-06-21T23:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434015#M90941</link>
      <description>&lt;P&gt;Thanks for taking the time to explain how I can go about changing this, I will look into this further and see if I can get this working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;Carl.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jun 2018 19:49:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434015#M90941</guid>
      <dc:creator>Carl Fransen1</dc:creator>
      <dc:date>2018-06-24T19:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434016#M90942</link>
      <description>&lt;P&gt;Hi Beth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please demonstrate the script you used in your knowledge content widget to query for the latest version?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nat&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 04:32:51 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434016#M90942</guid>
      <dc:creator>natty29</dc:creator>
      <dc:date>2018-09-04T04:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434017#M90943</link>
      <description>&lt;P&gt;I can't demonstrate, but I can describe what we did! Basically if you take a look at the service portal widget, you can see it's populating parameters at a certain point. Where it populates the sys_id parameter, we intercept that parameter and run a couple of queries:&lt;/P&gt;
&lt;P&gt;(worth noting that all of these changes are in the server script; I did not need to touch client script or HTML for this modification.)&lt;/P&gt;
&lt;P&gt;First, we grab the record identified by the sys_id url parameter&lt;/P&gt;
&lt;P&gt;Then we get the latest record using the kb helper for versioning&lt;/P&gt;
&lt;P&gt;Then we feed that back into&amp;nbsp;the script instead of letting it use the URL parameter&lt;/P&gt;
&lt;P&gt;The latest version helper is found in the KB_Versioning script include and I&amp;nbsp;&lt;EM&gt;believe&amp;nbsp;&lt;/EM&gt;it&amp;nbsp;takes the&amp;nbsp;KB number and not a sys_id, which is the reason for the first query. You might be able to get away without it if I'm remembering incorrectly.&lt;/P&gt;
&lt;P&gt;Did that clear&amp;nbsp;it up?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 17:12:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434017#M90943</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2018-09-06T17:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434018#M90944</link>
      <description>&lt;P&gt;I have created a custom portal widget. And I confirmed that it works properly.&lt;/P&gt;
&lt;P&gt;in this way!&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/159496iC0BB66567ADC4C2E/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;KB Article Page&lt;/P&gt;
&lt;P&gt;https://[your instance].service-now.com/nav_to.do?uri=sp_widget.do?sys_id=c6545050ff223100ba13ffffffffffe8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please replace with this code in Server Script after clone widget.&lt;/P&gt;
&lt;P&gt;-----------------------------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;var t = data;&lt;BR /&gt;data.kb_knowledge_page = $sp.getDisplayValue("kb_knowledge_page") || "kb_view";&lt;BR /&gt;var articleGR = GlideRecord("kb_knowledge");&lt;BR /&gt;var newestKB = newestGet($sp.getParameter('sys_id'));&lt;BR /&gt;articleGR.get(newestKB);&lt;BR /&gt;var recordIsValid = articleGR.isValidRecord();&lt;BR /&gt;var canReadArticle = articleGR.canRead();&lt;BR /&gt;t.isvalid = recordIsValid &amp;amp;&amp;amp; canReadArticle;&lt;/P&gt;
&lt;P&gt;if (canReadArticle) {&lt;BR /&gt; articleGR.incrementViewCount(); // update sys_view_count immediately on kb_knowledge record&lt;BR /&gt; var art = new GlideRecord("kb_use");&lt;BR /&gt; if (art.isValid()) {&lt;BR /&gt; art.article = articleGR.getUniqueValue();&lt;BR /&gt; art.user = gs.getUserID();&lt;BR /&gt; art.viewed = true;&lt;BR /&gt; art.insert(); // kb_use records are aggregated to update sys_view_count nightly&lt;BR /&gt; $sp.logStat('KB Article View', "kb_knowledge", articleGR.getUniqueValue(), articleGR.short_description);&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;t.category = articleGR.getValue('kb_category');&lt;BR /&gt; t.sys_id = newestKB;&lt;BR /&gt; t.showAttachments = false;&lt;BR /&gt; if (articleGR.display_attachments)&lt;BR /&gt; t.showAttachments = true;&lt;BR /&gt; t.categoryDisplay = articleGR.getDisplayValue('kb_category');&lt;BR /&gt; t.short_description = articleGR.getValue('short_description');&lt;BR /&gt; if (articleGR.getValue('article_type') == 'wiki')&lt;BR /&gt; t.text = GlideWikiModel().render(articleGR.getValue('wiki'));&lt;BR /&gt; else&lt;BR /&gt; t.text = articleGR.getValue('text');&lt;BR /&gt; t.sys_view_count = articleGR.getDisplayValue('sys_view_count');&lt;BR /&gt; t.author = articleGR.getDisplayValue('author');&lt;BR /&gt; t.publishedUtc = articleGR.getValue('published');&lt;BR /&gt; t.number = articleGR.getValue('number');&lt;BR /&gt; if (showStarRating())&lt;BR /&gt; t.rating = articleGR.getValue('rating');&lt;BR /&gt; t.direct = false;&lt;BR /&gt; if (articleGR.direct)&lt;BR /&gt; t.direct = true;&lt;/P&gt;
&lt;P&gt;t.breadcrumbs = [{label: t.short_description, url: '#'}];&lt;BR /&gt; if (!articleGR.kb_category.nil()) {&lt;BR /&gt; var rec = articleGR.kb_category.getRefRecord();&lt;BR /&gt; while (rec.getRecordClassName() == "kb_category") {&lt;BR /&gt; t.breadcrumbs.unshift({label: rec.getDisplayValue(), url: '?id=kb_category&amp;amp;kb_category=' + rec.getUniqueValue()});&lt;BR /&gt; rec = rec.parent_id.getRefRecord();&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; t.breadcrumbs.unshift({label: gs.getMessage("Knowledge Base"), url: '?id=' + t.kb_knowledge_page});&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;function showStarRating() {&lt;BR /&gt; if (options.show_star_rating == "Yes")&lt;BR /&gt; return true;&lt;/P&gt;
&lt;P&gt;if (options.show_star_rating == "No")&lt;BR /&gt; return false;&lt;/P&gt;
&lt;P&gt;if (gs.getProperty("glide.knowman.show_star_rating", "true") != "true")&lt;BR /&gt; return false;&lt;/P&gt;
&lt;P&gt;return gs.hasRole(gs.getProperty("glide.knowman.show_star_rating.roles"));&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;function newestGet(sys_id){&lt;BR /&gt; var kb = new GlideRecord('kb_knowledge');&lt;BR /&gt; kb.addQuery('sys_id', sys_id);&lt;BR /&gt; kb.addQuery('workflow_state', 'outdated');&lt;BR /&gt; kb.query();&lt;/P&gt;
&lt;P&gt;if(!kb.next()){&lt;BR /&gt; return sys_id; // current sys_id&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;var kbn = new GlideRecord('kb_knowledge');&lt;BR /&gt; kbn.addQuery('number', kb.number);&lt;BR /&gt; kbn.addQuery('workflow_state', 'published');&lt;BR /&gt; kbn.query();&lt;/P&gt;
&lt;P&gt;if(kbn.next()){&lt;BR /&gt; return kbn.sys_id; // newestKB sys_id&lt;BR /&gt; }&lt;BR /&gt; return sys_id; // exception&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;-----------------------------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope things are going well for you!&lt;/P&gt;
&lt;P&gt;Sungsu&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 02:50:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434018#M90944</guid>
      <dc:creator>s_kang</dc:creator>
      <dc:date>2018-09-07T02:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434019#M90945</link>
      <description>&lt;P&gt;Thank you very much &lt;SPAN class="ng-scope"&gt;Sungsu&lt;/SPAN&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:42:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434019#M90945</guid>
      <dc:creator>natty29</dc:creator>
      <dc:date>2018-09-13T20:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434020#M90946</link>
      <description>&lt;P&gt;It's really painful that KB versioning is so hard to get right in Portal with us all reinventing the wheel. ServiceNow really dropped the ball with KB versioning and Portal.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot imaging a scenario in Portal where you would ever want to see an old version of the article. Surely ServiceNow should have updated all related widgets by now to have a 'go to latest version' option which would be the default.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 09:46:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434020#M90946</guid>
      <dc:creator>Paul Curwen</dc:creator>
      <dc:date>2019-08-13T09:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434021#M90947</link>
      <description>&lt;P&gt;Since this has become something of a hub for this conversation:&lt;/P&gt;
&lt;P&gt;As far as I know, there's still no good answer for this problem. Owning the KB view widget partially solves the problem, but there are other widgets that start to have issues (like kb_header) and long term it feels like I'm going to own more and more of this page if I want everything to work right.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Realistically, everything I do is a band-aid, since we don't have good visibility on some of the versioning code to fix the problem at the source. If/when SN comes out with a better solution, I'll circle back and update this answer, but right now check the comments for several potential workarounds for this problem.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 15:56:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434021#M90947</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2019-08-19T15:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434022#M90948</link>
      <description>&lt;P&gt;You can retain branding by using the Madrid &lt;A href="https://docs.servicenow.com/bundle/madrid-servicenow-platform/page/product/knowledge-management/task/activate-km-service-portal-plugin.html?cshalt=yes" rel="nofollow"&gt;Knowledge Base portal plugin&lt;/A&gt; (com.snc.knowledge_serviceportal). This adds a new portal (/kb) designed to replace the Service Portal knowledge base page.&lt;/P&gt;
&lt;P&gt;Articles can then be permalinked directly to the portal, e.g.:&lt;/P&gt;
&lt;P&gt;https://xxxx.service-now.com/kb?id=kb_article_view&amp;amp;sysparm_article=KB0010528&lt;/P&gt;
&lt;P&gt;A copy permalink button appears at the bottom of articles within this portal:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/159500i7F23680D49ADBCFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 09:36:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434022#M90948</guid>
      <dc:creator>James150</dc:creator>
      <dc:date>2019-09-06T09:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434023#M90949</link>
      <description>&lt;P&gt;Thank you Beth for this very detailed write up. It seems we are all suffering from the same issues. That is sadly comforting. I am HIGHLY interested in any solutions you obtain for this, and I in-turn will share if we obtain any. In my opinion, based on so many shortcomings is that SN is NOT a useful KM solution.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 20:01:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434023#M90949</guid>
      <dc:creator>Michael QCKM</dc:creator>
      <dc:date>2019-12-12T20:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434024#M90950</link>
      <description>&lt;P&gt;I believe our payers on versioning (and frustrations with this) have been answered in New York. See:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/build/service-portal/task/redirect-knowledge.html" rel="nofollow"&gt;https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/build/service-portal/task/redirect-knowledge.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Haven't tested this out yet but if what I'm reading is right it's the answer we've been looking for for years. This is the fella:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/159488i6706125E2170A05A/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if anyone has success with this.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Paul&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 16:35:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434024#M90950</guid>
      <dc:creator>Paul Curwen</dc:creator>
      <dc:date>2019-12-13T16:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434025#M90951</link>
      <description>&lt;P&gt;Old thread but I'm guessing it's still a problem? I at least have not found a way to create durable links between articles (preferably using the internal/ITIL view kb_view permalink) that directs you to the same UI you're viewing it from. &lt;/P&gt;
&lt;P&gt;We tried using the permalinks from the portal but then there was a change on the portal URL and all links broke.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:58:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434025#M90951</guid>
      <dc:creator>Erik24</dc:creator>
      <dc:date>2020-09-29T08:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Knowledge article dynamic linking</title>
      <link>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434026#M90952</link>
      <description>&lt;P&gt;Hi Eric,&lt;/P&gt;
&lt;P&gt;Yes, we still have our custom solution in place. We added a custom parameter (kb_number) and check for that parameter as well as the default sys_id; if we see kb_number defined, then we use a quick gliderecord on the server script for the article's sys_id. We then feed that into the default code for the widget. This invoved owning the header and body widgets (which has proved a pain when we wanted to implement knowledge blocks!)&lt;/P&gt;
&lt;P&gt;A smoother method I've ended up using elsewhere is this:&lt;/P&gt;
&lt;P&gt;- Accept any sys_id&lt;/P&gt;
&lt;P&gt;- Check to see if the retrieved article is the latest version&lt;/P&gt;
&lt;P&gt;- If it's not, go retrieve the latest and use it instead.&lt;/P&gt;
&lt;P&gt;It's got the benefit of being seamless and not requiring you to own everything that ever generates a link to articles, just the things that process them (the header and and the body only, I think; if memory serves, the comments section gets the article information from the header, though that may have changed.) It's allowed me to greatly decrease the footprint of widgets we own related to this, and allows for more graceful handling of the links generated by contextual search.&lt;/P&gt;
&lt;P&gt;Let me know if you need a hand and I can probably whip up some quick demo code on my developer instance.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 21:37:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/knowledge-article-dynamic-linking/m-p/1434026#M90952</guid>
      <dc:creator>Beth11</dc:creator>
      <dc:date>2020-10-02T21:37:05Z</dc:date>
    </item>
  </channel>
</rss>

