- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 09:10 AM
I have a server that will catch links to old broken URLS and redirect it to a knowledgebase article. That's all well and good, but I'd much rather have a quick script update the URL and print it as a clickable link instead.
As psuedocode:
function onLoad() {
//psuedocode
// Check if they're viewing the KB I wrote to catch the redirects
if (<theKBnumber> == KB4090329){
var origDest = urlVariables[origURL];
// Take for granted I have a function that spits out a corrected URL here
var fixedDest = fixUrl(origDest);
writeToKB(`
The URL you tried to load is no longer valid, but here's a replacement link:
<a href=fixedDest>fixedDest</a>
You can click the above, but please also fix your bookmarks if you want to avoid this page in the future.
`);
}
}
So far, I can't get any kind of message or text to appear when loading KB articles with Client Scripts. I've been trying everything I could find, but nothing seems to work or display:
function onLoad() {
var heywo = "hello world";
this._knowledgeHelper.addUniqueInfoMessage("test message",'');
alert(heywo);
console.log(heywo)
//msg = getMessage(heywo);
//g_form.addErrorMessage(msg);
}
Is this not something that's possible in ServiceNow?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 07:51 AM
Based on another question I asked, this isn't possible with client scripts and has to be done through direct edit of the widgets that display KBs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 07:51 AM
Based on another question I asked, this isn't possible with client scripts and has to be done through direct edit of the widgets that display KBs.