We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Create Custom Date filter

Kuldeep Kumavat
Mega Guru

Hello Experts,

 

We have a business requirement to create a new date filter option similar to 'Quarterly'. Our customer works in a period of 4 months frequency (Quadrimestral), they have 3 periods in each year.

So, the ask is to collect and visualize data w.r.t. this frequency instead of what ServiceNow provides OOB.

We want to use conditions in indicator sources like Created on This Quadrimestral or Created on Last Quadrimestral. And similarly the visualizations on the widgets also should be displayed corresponding to this period.


Would like to know if this is achievable?

4 REPLIES 4

Aditya_hublikar
Mega Sage

Hello @Kuldeep Kumavat ,

 

I read your requirnment also refered some threads.

 

 

I created dynamic filter (all=>dynamic filter option.do)

Screenshot (1184).png

 

Aditya_hublikar_2-1771172177580.png

 

here selected referenced table as user to get this filter in is(dymaic) operator value.

 

 

script include :

 function getQuadrimesterRange() {

        var now = new GlideDateTime();
        var month = parseInt(now.getMonthLocalTime()) + 1;
		gs.log(month)

        var quadStartMonth = Math.floor((month - 1) / 4) * 4 + 1;

        var startDate = new GlideDateTime();
        startDate.setMonthLocalTime(quadStartMonth - 1);
        startDate.setDayOfMonthLocalTime(1);
        startDate.setHourLocalTime(0);
        startDate.setMinuteLocalTime(0);
        startDate.setSecondLocalTime(0);

        var endDate = new GlideDateTime(startDate);
        endDate.addMonths(4);
        endDate.addSeconds(-1);

        return startDate.getValue() + "@" + endDate.getValue();
    }

 

 

Aditya_hublikar_3-1771172196790.png

 

 

But here getting one isuue for this filter is(dynamic) is not available for created/updated field.

But when i select caller is(dynamic) filter getting this custom filter This quadrimetal Data

 

Aditya_hublikar_4-1771172437433.png

 

Aditya_hublikar_5-1771172469380.png

 

 

I’m not sure why this is happening. The custom dynamic filter is not available for the Created or Updated fields. However, the data is filtering correctly as per the requirement when I apply Caller is (dynamic) This Quadrimester Data 🙂 .

 

If you have to use that only for reporting i think  this is fine but logically condition should be created on this Quadrimester Data   but its working for condition like caller is(dynamic) this Quadrimester Data  

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya,

Technical Consultant

Hello @Kuldeep Kumavat ,

 

 I hope you are doing well . Does my response helps you ?

 

If my response helps you then mark it as helpful and accept as solution

Regards,

Aditya ,

Technical Consultant

CalNeave
Mega Expert

Hi Kuldeep,

Yeah I think you can do this by going to business_calendar_group table and getting set up from there.

I'd use "gregorian calendar" as a template for configuring your quadrimestral (what a word :D) cycles.
https://www.servicenow.com/docs/r/platform-administration/time-configuration/create-business-calenda...

Screenshot 2026-02-15 163807.pngScreenshot 2026-02-15 163851.png