- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2019 03:59 AM
Hi All,
How many months data is considered to show in recent and popular items widget in Service Portal?
I would like to edit that to show only last one months recent items. Is that possible ? If yes where can be done.
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2019 04:21 AM
Hi,
you have to clone the Recent & Popular Items widget and put instead of the following part of Server Script:
if (options.popular_items_created == 3)
createdQuery = 'sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()^';
else if (options.popular_items_created == 6)
createdQuery = 'sys_created_onONLast 6 months@javascript:gs.beginningOfLast6Months()@javascript:gs.endOfLast6Months()^';
else if (options.popular_items_created == 12)
createdQuery = 'sys_created_onONLast 12 months@javascript:gs.beginningOfLast12Months()@javascript:gs.endOfLast12Months()^';
Put the following script:
if (options.popular_items_created == 3)
createdQuery = 'sys_created_onONLast month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()^';
Then, ensure that the widget have the option Popular Items Created set to Last 3 Months (from https://instance_name.service-now.com/sp?id=sc_home right click on the Popular Items widget > select Instance Options😞
I've just tried it in my personal instance, it works perfectly!
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2019 04:21 AM
Hi,
you have to clone the Recent & Popular Items widget and put instead of the following part of Server Script:
if (options.popular_items_created == 3)
createdQuery = 'sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()^';
else if (options.popular_items_created == 6)
createdQuery = 'sys_created_onONLast 6 months@javascript:gs.beginningOfLast6Months()@javascript:gs.endOfLast6Months()^';
else if (options.popular_items_created == 12)
createdQuery = 'sys_created_onONLast 12 months@javascript:gs.beginningOfLast12Months()@javascript:gs.endOfLast12Months()^';
Put the following script:
if (options.popular_items_created == 3)
createdQuery = 'sys_created_onONLast month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()^';
Then, ensure that the widget have the option Popular Items Created set to Last 3 Months (from https://instance_name.service-now.com/sp?id=sc_home right click on the Popular Items widget > select Instance Options😞
I've just tried it in my personal instance, it works perfectly!
If I have answered your question, please mark my response as correct and/or helpful.
Thank you very much
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2019 01:27 AM
Any update on this?
If I have answered your question, please mark my response as correct.
Thank you very much
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2020 09:03 AM
Hi Alberto,
here i want to restrict like display only for 3 months and for logged in User item or with respect to particular category selected .. is that possible, is yes please help.
thanks