view count knowledge base
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 12:34 AM
Hi Team,
The view count is set back to zero after a knowledge base article is edited. Is there any way to stop the view count to set back to Zero after edits.
I got a situation that after editing of a pre existing knowledge article it view count become zero. For example if the view count was 65 before and after checkout and editing and again re-publishing it the view count become 0 inspite of 66 since the knowledge article is same it is just edited.
Thanks,
Subhabrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 02:21 AM
Hi,
A knowledge article is versioned, so every edit is a new published version, which is a new record.
This means you should have a business rule or flow to retrieve the sys_view_count of the previous published version and copy this to the new version.
If you have a onbefore business rule when the workflow_state field moves to published, you can do a query on the article version (kb_version).
Something like:
(function executeRule(current, previous) {
var grKBVersion = new GlideRecord('kb_version');
grKBVersion.addQuery('knowledge.article_id',current.getValue('article_id'));
grKBVersion.addQuery('knowledge.workflow_state','published');
grKBVersion.query();
if(grKBVersion.next()){
current.setValue('sys_view_count',grKBVersion.getValue('knowledge.sys_view_count'));
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 12:44 AM
Hi @Hayo Lubbers Thank you for the ans will definitely try your process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 03:25 AM
hi @Hayo Lubbers can you please provide some more details or documentation on this. It will be more helpfull for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 12:34 AM
Hi @subhadutta23069 ,
The only documentation regarding the versioning is more generic : https://docs.servicenow.com/bundle/washingtondc-servicenow-platform/page/product/knowledge-managemen....
If you don't want to have a new version for every minor change, you could have a look at the glide.knowman.versioning.enable_minor_edits property and specify which fields can be edited without new version.
You can also have a look at knowledge blocks, which versions the blocks, not the whole article. This is mainly interesting in combined articles (e.g. generic information + support information or information which is different for different offices/regions/countries).