Using permalinks in Service Portal for Knowledge Articles (versioned)

SusanWinKY
Kilo Sage

We're using version control for Knowledge and are using Service Portal.  The Service Portal formatted permalink for a versioned article changes each time it is updated because it's based on the article's sys ID.  For example:

 

Version 1.0:  https://<instance>.service-now.com/sp?id=kb_article_view&sys_kb_id=ab921c86db5453007ad45096dc961982

Version 2.0:  https://<instance>.service-now.com/sp?id=kb_article_view&sys_kb_id=96dbc040db6c93407ad45096dc96194e

 

We routinely link to an article from within another article.  So when we update an article, we're going to have "broken" links.  I understand the link will still work and the user can click the "An updated version of this article is available." link at the top of the downlevel article to get the latest version, but that's not an ideal user experience.

 

At this point, we may have to point our internal links to the platform article, which instead of the sys ID uses the KB #.  For example:

https://<instance>.service-now.com/kb_view.do?sysparm_article=KB0010035

 

That's also not an idea user experience.

 

Has anyone dealt with this?  And if so, what did you do? 


Susan Williams, Lexmark
1 ACCEPTED SOLUTION

Rajesh Kannan G
ServiceNow Employee
ServiceNow Employee

Hi Susan,

You can use https://<instance>.service-now.com/sp?id=kb_article_view&sysparm_article=KBXXX it will show latest accessible article version to the user.

Thanks,

Rajesh

View solution in original post

19 REPLIES 19

Hi Rajesh,

This doesn't work for us, it's coming up with the 404 error.

We don't have the knowledge portal installed, we're just going through the /sp and trying to view the article using the KB name not the sys_id.

I'm trying to replace my original link with the sys_id:

https://instance.service-now.com/sp?id=kb_article&sys_id=28127ebfdb170f40f39844fc449619f5

with this:

https://instance.service-now.com/sp?id=kb_article_view&sysparm_article=KB00XXXX

 

Any ideas what else I can use in my URL to view the article using the KB name?

 

Thanks

Carl.

brookem
Kilo Contributor

Dealing with this as well. We just activated the Knowledge Portal and now the Copy Permalink is giving us https://<instance>.service-now.com/sp?id=kb_article_view&sys_kb_id=96dbc040db6c93407ad45096dc96194e prior to moving to the Knowledge Portal the Copy Permalink was returning https://<instance>.service-now.com/sp?id=kb_article_view&sysparm_article=KBXXX.  

Brooke, we ended up modifying the code in the widget. When I get back to the office, I’ll reply here with details of how we did that.

Susan Williams, Lexmark

Here's what we've done to enable consistent permalinks with versioned articles.  We cloned the Knowledge Article Content widget.  In the new widget, we made these changes: 

  • In the Body HTML Template, commented out reference to the copy permalink function and replaced it with a new one.
	<!-- <p class="pull-right kb-permalink"><a href="javascript:void(2)" ng-click="c.copyPermalink()">{{::data.messages.COPY_PERMALINK}}</a></p> -->
	<p class="pull-right kb-permalink"><a href="javascript:void(3)" ng-click="c.copyPermalinkLatest()">{{::data.messages.COPY_PERMALINK_LATEST}}</a></p>
  • In the Server Script, created a new permalink message with the new one added to the Body HTML Template.
		data.messages.COPY_PERMALINK = gs.getMessage("Copy Permalink (this version)");
		data.messages.COPY_PERMALINK_LATEST = gs.getMessage("Copy Permalink");
  • Added the new function to the Client Controller.
	c.copyPermalinkLatest = function(){
			var v = document.createElement('textarea');
			v.innerHTML = document.location.href;
			v.innerHTML = document.location.href.split("&")[0] + "&sysparm_article=" + $scope.data.number;
			//spUtil.addInfoMessage(v.innerHTML);
			v.className = "sr-only";
			document.body.appendChild(v);
			v.select();
			var result = true;
			try {
				result = document.execCommand('copy');
			}
			catch(err){
				result = false;
			}
			finally{
				document.body.removeChild(v);
			}			
		if(result === true){
			spUtil.addInfoMessage(c.data.messages.PERMALINK_COPIED);
		}
		else{
			$window.prompt("${Because of a browser limitation the URL can not be placed directly in the clipboard. Please use Ctrl-C to copy the data and escape to dismiss this dialog}", document.location.href);
		}
		
	};

 

 

 


Susan Williams, Lexmark

Hi Susan,

I couldn't find any widgets in our environment that includes the HTML code you referenced.  Which widget are you referring to?  We are on Jakarta... not sure if that matters in this case. 

 

Thanks!

michael