UI Script for Redirection

Davy Lin
Kilo Explorer

Hello top experts,

Does anyone know how to use UI Script to redirect the following,

redirecting from /ssp/show_knowledge.do?sysparm_article=KB1234567

to /sp?id=kb_article_view&sysparm_article=KB1234567

for all knowledge article numbers? -- KB1234567 from above is just a sample #.

Thanks in advance!

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I think you would probably write something on your show_knowledge cms page that does the redirect. Basically some JS that runs on the page load, grabs the KB number, then puts it in the window.open() function. You could also rename that cms page and create a new one that does the redirect only. Here some links to get you started:

https://www.w3schools.com/howto/howto_js_redirect_webpage.asp

https://html-online.com/articles/get-url-parameters-javascript/

warnerjonn
Kilo Contributor

window.location.replace('http://w3c.com');

It’s better than using window.location.href = 'http://w3c.com';

Using replace() is better for javascript redirect , because it does not keep the originating page in the session history, meaning the user won’t get stuck in a never-ending back-button fiasco.