How do I create a 'Recent Items' widget based on the 'Recent & Popular Items' widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 04:47 AM
I'm wanting to create a separate widget for 'Popular Items' that currently include viewed knowledge articles and catalogue items.
I understand that there is already an OOTB widget called 'Recent & Popular Items':
However, the only problem with the 'My Recent Items' tab is that it only shows catalogue items as opposed to showing catalogue items and knowledge articles.
Does anyone know what I would need to do get a brand new 'Recent Items' based on the current functionality, but including knowledge articles?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 05:38 AM
Hi @matthew_hughes!
You can clone this widget and perform a get on the kb_use table using GlideRecord and applying the query: viewed = true.
With the data obtained from the table, you can build the same logic as exists for the data.popularItems[] and data.recentItems[] arrays of this widget.
If my answer helped you in any way, please mark it as correct/helpful 🙂
Regards,
Isaac Vicentini.
MVP 2025 ✨
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 06:44 AM
So there's no way of taking out the section that currently exists and reapplying it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 06:52 AM
Yes, it is possible, but you must do this on the cloned widget and not on the original widget.
All you have to do is analyze which block of code you want to remove or change.
Below is an example in red of the code block for the My Recent Items tab and in green the code block for the Popular Items tab:
If my answer helped you in any way, please mark it as correct/helpful 🎯
Regards,
Isaac Vicentini.
MVP 2025 ✨