How to show latest version of knowledge articles through script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 05:54 PM
I have created fixed script to publish retired articles and change valid to date increased by 30 days to see retired articles on portal , its working , only the issue is client want to publish latest version of articles
How to achieve this via script?
this is my script
Please help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 06:03 PM
HI @Asha Pathak you can utilise OOB script include in your fix script which will check versions
script include name: GlobalKnowledgeUtilSNC
check function:canRepublish
or you could sort by date to get the latest article like below
var gr = new GlideRecord('kb_knowledge');
gr.orderByDesc('sys_updated_on');
gr.query();
while(gr.next()) {
gs.info('Knowledge Article: ' + gr.number + ', Version: ' + gr.version + ', Last Updated: ' + gr.sys_updated_on);
}
Harish