Most Useful section in Knowledge homepage configurable?

priyajamesalcor
Kilo Contributor

Dear all,

I am working for a Client who have a requirement to manually push articles to 'Most Useful' section in the Knowledge Homepage.

As I read fro Servicenow docs that articles come under 'Most Viewed' only if it is marked helpful, so wanted to know if we can push them to that section manually?

Is it doable? If yes then how?

Thanks,

PJ

4 REPLIES 4

Manjeet Singh
ServiceNow Employee
ServiceNow Employee

Most useful and most viewed is populated automatically when people are starting to use and mark them like/helpful.


If you want to push some KB manually then use the featured content section of the knowledge base.


find_real_file.png


Fill in the article number and under keywords, you need to add "homepage".


Save and it will show up under feature content.



Thanks,


Manjeet


him001
ServiceNow Employee
ServiceNow Employee

Hi Priya,


With admin access, you can run below code from the background script and manually add the knowledge articles in the Most Useful section on Homepage:



See the below example script:



--------------------------------------------------------------


var arr = ['e97ee81eff6002009b20ffffffffffe0', '471ee81eff6002009b20ffffffffff34'];     // array with the sys_id's of the published KB articles, which want to show


var gr = new GlideRecord("kb_feedback"); // This table derives what can be seen in most useful section, based on the 'useful' field


for (var i = 0; i < arr.length; i++) { // manually insert the KB articles


gr.initialize();


gr.article = arr[i];


gr.useful = "yes";


gr.insert();


}


------------------------------------------------------------------------



Hope this helps.



Thanks,


Himanshu


Thanks Himanshu. But this is like hard coding right as we pass the sys ids manually each time we want to move an article to 'Most Useful'.



Regards,


Priya


Hi Priya,


You can very well achieve this by adding a custom field on the knowledge base table. Something like below:



1. Create a custom field on table 'kb_knowledge_base', of the type 'list', which shows all the published knowledge articles from the current knowledge base



2. Select the articles from the list which you want to add in the 'Most useful' section.



3. Add a business rule, which will execute the above script by reading the elements from the list (basically all the selected articles will be added in kb_feedback table) This way you wont need to deal with the hard coded sys_ids.




Hope this helps.




Thanks,


Himanshu