Condition for 60 day date validation

miro2
Mega Sage

Hi,

I have to create a condition to meet the below requirement:
Date of today is greater than Date of field 'Sent for Approval' + 60 days. The Date of field 'Sent for Approval' is a variable and I was able to add its value in the Dashboard using database view. I want to check which condition will be better: 

javascript:gs.daysAgoStart(60)

or '60@days@ago'?

 

The value field is the date of the field 'Sent for Approval'

miro2_0-1769771597677.pngor

miro2_1-1769771616676.png

 

 

 

13 REPLIES 13

I am trying on change record:

 

DrAtulGLNG_0-1769776277248.png

 

try similar for value.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG 
The Planned End Date is a date-type field, so you can use it. However, in my use case, the 'Value' field is a string type, which is why I can’t use before like in your Change Request example. 

miro2_0-1769777280943.png
That’s why I need a condition.

miro2_1-1769777469977.png

 

 

Hi @miro2 

That’s a challenge. You need to store this in a proper date format first; then you can compare it. Otherwise, there’s no easy or direct way to do it. A date can be compared to another date, but a date versus a string cannot.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@miro2 

share how and from where that filter is going to be applied.

Please share complete screenshots

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 
miro2_0-1769773785232.png


This will be used in a dashboard in Single Score visualization. The data source is my Database view combined from 3 different tables (HR Payroll, Custom, and Question Answer tables).

The 'Value' field comes from the Question Answer table (Value in my particular use case will store date in String field). Since I wasn't able to fetch the variable value directly, I had to fetch it from the Question Answer table.

miro2_1-1769774188141.png