Can you 'reset' the counter for a catalog item so it doesn't show under Popular items in service portal

Dan R
Kilo Expert

Hey SNC!

 

We have re-arranged some of our catalog items on the service portal and because of this, we want to reset CERTAIN CAT ITEMS from appearing in the popular items widget on the service portal. To clarify, I don't want to reset the entire popular items listing (not sure if that's even possible), I'm hoping to reset the 'counter' (or however it's done), for specific catalog items only.

 

I have been unable to find any information regarding this nor have I seen any community posts similar. 

 

Anyone know if it's possible to reset this and provide steps on doing so?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

The Service Portal Widget for Recent & Popular Items is looking at the sp_log table.

var recent = new GlideAggregate('sp_log');
recent.addAggregate('COUNT', 'id');
if (recent_by === 'view')
	recent.addEncodedQuery('userDYNAMIC90d1921e5f510100a9ad2572f2b477fe^type=Cat Item View^sys_created_onONThis quarter@javascript:gs.beginningOfThisQuarter()@javascript:gs.endOfThisQuarter()');
else
	recent.addEncodedQuery('userDYNAMIC90d1921e5f510100a9ad2572f2b477fe^type=Cat Item Request^sys_created_onONThis quarter@javascript:gs.beginningOfThisQuarter()@javascript:gs.endOfThisQuarter()');
recent.groupBy('id');

So If you would like to achieve what you are describing, you have to change the widget queries or clean the sp_log table a bit.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

2 REPLIES 2

Mark Roethof
Tera Patron
Tera Patron

Hi there,

The Service Portal Widget for Recent & Popular Items is looking at the sp_log table.

var recent = new GlideAggregate('sp_log');
recent.addAggregate('COUNT', 'id');
if (recent_by === 'view')
	recent.addEncodedQuery('userDYNAMIC90d1921e5f510100a9ad2572f2b477fe^type=Cat Item View^sys_created_onONThis quarter@javascript:gs.beginningOfThisQuarter()@javascript:gs.endOfThisQuarter()');
else
	recent.addEncodedQuery('userDYNAMIC90d1921e5f510100a9ad2572f2b477fe^type=Cat Item Request^sys_created_onONThis quarter@javascript:gs.beginningOfThisQuarter()@javascript:gs.endOfThisQuarter()');
recent.groupBy('id');

So If you would like to achieve what you are describing, you have to change the widget queries or clean the sp_log table a bit.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks Marc for pinpointing where this is being calculated. Wish there was a more OOtB solution, but good to know it can be accomplished with a custom widget.