Copy Permalink button

othews
Giga Contributor

Hi,

We're running Servicenow on premise and have an issue with the "Copy permalink" button in the Knowledge article view. 
Since we're running on prem we have several servers and when the "Copy permalink" function is used it copies the URL to one of the servers (which the users cannot access) instead of the instance URL. 
So basically what happens is we get something like this: https://<servername01>.<domain>/kb_view.do?sysparm_article=KBXXXXXXX When what we want is https://<instance url>/kb_view.do?sysparm_article=KBXXXXXXX.

How can we change this behavior? our glide.servlet.uri is correctly configured.

Best Regards

Ola

3 REPLIES 3

Kalaiarasan Pus
Giga Sage

The script that shows the copy link is kb_view_common_footer_metadata_fields. So instead of window.location.origin in the macro, replace with the property that you just listed.

We do not have a window.location.origin value in the macro. 

Our script looks like this: 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j2:if test="$[sysparm_media != 'print']">
<div class="snc-article-footer-metadata-permalink">
<a href="#" id="permalink" aria-label="${gs.getMessage('Copy Permalink')}">${gs.getMessage('Copy Permalink')}</a>
</div>
<script language="javascript">
$j('#permalink').click(
function(){
//generate direct url to this article, by getting the domain and adding sysparm_article=NUMBER_OF_ARTICLE
copyToClipboard('${permalink}');
return false;
}
);
</script>
</j2:if>
</j:jelly>

Whatever is inside copyToClipboard gets copied. So pass the property value to the copyToClipboard function.

 

copyToClipboard('${permalink}');