If Condition script for date validation

KS13
Tera Contributor

Hello, 

I was hoping someone can help me with a script for an if condition on a Service Catalog workflow. 

There is a field on the form 'end_date', which is autopopulated based  on a Change Request Number selected. (references the change_request table in SNOW). 

Within the workflow, i need to write an if condtion in the workflow where  it checks end_date value, compare it to the current date and time. If the end_date is in the past, return as Yes else if end_date has not passed the current date, then return No. 

 

Thank you in advance!

1 ACCEPTED SOLUTION

Zach Koch
Giga Sage
Giga Sage

You should be able to do this easily using OOTB GlideDateTime method of compareTo(). Here is the link to the docs, as well as some screenshots of the relevant info. 

glideDateTime.compareTo() 

ZachKoch_0-1718285528880.png

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

1 REPLY 1

Zach Koch
Giga Sage
Giga Sage

You should be able to do this easily using OOTB GlideDateTime method of compareTo(). Here is the link to the docs, as well as some screenshots of the relevant info. 

glideDateTime.compareTo() 

ZachKoch_0-1718285528880.png

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!