How to display knowledge article based on number instead of sys_id

shayam1
Tera Contributor

How to display knowledge article based on number instead of sys_id

Ex: Giving 

/sp=id?pagename&number=KB123456 -> but it is not working

 

if I give /sp=id?pagename&sys_id=123456c8a1374ef04c1d37a836144b0f2-> but it is working

 

 

9 REPLIES 9

Hi Vignesh,

in typeahead search widget if enter the article number and click the dropdown link, it should open URL with kb article number, but it is opening sys_id number. I need to change the Sys_id to article number.

 

below is the code

c.searchItems = result.results.map(function(item) {
var config = c.data.searchSourceConfiguration[item.__search_source_id__];
if (!item.url && config.linkToPage) {
item.url = "?id=" + config.linkToPage;
if (item.sys_id)
item.url += "&sys_id=" + item.sys_id;
}

 

If I am changing the "Item.url += "&sys_id=" + item.number;" it is showing undefined. where should I go and change the code.

shayam1_0-1673614729744.png

Advance thx

 

Hi shayam1,

If you want to use kb number in the URL, use it like this

/sp?id=kb_article&sysparm_article=KB0000028

Hi Vignesh,

If we write directly it is working , but I need to modify the code in typeahead widget, because if I click the link/dropdown value click then only it should redirect to article number.

ARG645
Tera Guru

Kalilovenox
Tera Contributor

Hello,
you can use "https://<intance-name>.service-now.com/sp?id=kb_article&sysparm_article=KBXXX"

sysparm_article instead of sys_id