How to create interactive filter for year wise
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 01:08 AM
We need an interactive filter where user can select years like 2010 or 2011 or 2019 etc.. instead of last year or this year. Please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 01:30 AM
You can create custom date/time filter option like below
- Navigate to All > System Definition > Business Rules.
- Open the business rule Get Date Filter Options for Date Filters.This rule populates the list of selectable options in forms for new or existing date type interactive filters.
- On the Advanced tab, modify the Script field to include the JavaScript needed to add the new option. Add the following line:
- answer.add('2020_One year ago@javascript:gs.monthsAgo(24)@javascript:gs.endOfThisMonth()', gs.getMessage('2020'));
- answer.add('2019_One year ago@javascript:gs.monthsAgo(36)@javascript:gs.endOfThisMonth()', gs.getMessage('2019'));
For more information please refer below docs
Please Mark Helpful and correct if it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 02:35 AM
I'm getting like this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 02:42 AM
You can add below line
nswer.add('2021_One year ago@javascript:gs.monthsAgo(12)@javascript:gs.endOfThisMonth()', gs.getMessage('Year 2021'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 01:46 AM
Go to your dashboard
Click on + icon as shown in image below
Select interactive filters from dropdown and click on Date as in image below
Click on #New Date and then click on Add button
Date filter will be added to dashbaord as below, click the link shown in image
Fill the form to create new interactive filter
Move the filter conditions required to right
Save the form and go to related list to add on which table and field this filter should apply
Create new in related list as in image below
I selected incident table and created date.
Submit the form and come back to dashboard to see added interactive filter
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023