Add option to date filter

alexcolbert
Kilo Guru

Hi Community,

 

I am attempting to add an extra value to the date filter:

 

find_real_file.png

 

From reading other posts I think the key lies in modifying the "Get Date Filter Options for Date Filters" business rule but I have added the line that I want and it does not appear to work.

 

To clarify, I am trying to add an option for "Last 2 months" and added the below line to the business rule:

 

answer.add('041_Last 2 months@javascript:gs.monthsAgoStart(2)@javascript:gs.endOfThisMonth()', gs.getMessage('Last 2 months'));

 

Do i need to change anything else to get this to work?

 

Thanks!

 

Alex

5 REPLIES 5

Munender Singh
Mega Sage

Hi,

 

Modify your piece of code in this way:

 

answer.add('041_Last 2 months@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoStart(-60)', 'Last 2 months');

 

***Mark helpful/correct if it works for you

 

Regards,

Munender

Hi Munender,

 

Thanks for your suggestion.  Unfortunately this didn't work.

 

I'm not totally convinced that this business rule is responsible for the available filter options.

 

I commented out a couple of the options but this didn't have any effect on the filter.

 

Do you know if these filter options could be added/controlled from somewhere else?

 

Thanks,

 

Alex

rad2
Mega Sage

Checkout this resource - https://docs.servicenow.com/bundle/london-performance-analytics-and-reporting/page/use/dashboards/ta...

this might help in resolving the issue 

dhananjay21
Giga Guru

@alexcolbert  Hi, were you able to resolve the issue as i'm also facing the similar issue.

I've added the choice in the BR but still not able to see that choice on table filter.

Please let me know if you have found a solution.