Need help on pulling a report to find the view count/usage of KB article month wise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 09:40 AM
Need help on pulling a report to find the view count/usage of KB article month wise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 09:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 10:19 AM
I have created the same, view count coming here is total number of views of that KB article, but I need the view count of the last 3 months for that KB article.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2024 12:25 PM - edited ‎05-03-2024 12:25 PM
Oh that's cool....!
I believe, you need something like below.
To recreate this in your instance, create a new field in "kb_use" table. Here I have created a string field called "Month". You can populate that field value using business rule for the upcoming records. But for the existing one you can use Background script. Below I have attached the code snippet, you can make use of it.
This is for background script,
var kbUse = new GlideRecord('kb_use');
kbUse.addEncodedQuery();
kbUse.query();
var month, newMonth;
while(kbUse.next()){
month = new GlideDateTime(kbUse.sys_created_on);
newMonth = month.getMonth();
kbUse.u_month = newMonth;
kbUse.update();
}
This is for Business rule,
var month, newMonth;
month = current.sys_created_on;
month = new GlideDateTime(month);
newMonth = month.getMonth();
current.u_month = newMonth;
current.setWorkflow(false);
current.update();
Hope this will help you to pull your reports. If yes, please mark my response as solution and give a thumbs up. Cheers....!
Regards,
Dhanraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2024 09:58 AM
Is there any other way instead of creating a new field in kb_use table.