Edit Recent and Popular Items in Service Portal

sk59
Tera Expert

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.

1 ACCEPTED SOLUTION

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

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😞

find_real_file.png

find_real_file.png

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

View solution in original post

3 REPLIES 3

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

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😞

find_real_file.png

find_real_file.png

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

Any update on this?

If I have answered your question, please mark my response as correct.

Thank you very much

Cheers
Alberto

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