Workflow Studio Flow Date condition

jyan3
Kilo Guru

I'm trying to do a lookup on the alm_asset table where the warranty expiration date is 90 days from the current day, but the drop down only goes as far as tomorrow for future dates. Is there a way to get it to select a day number? Otherwise what is the script syntax to get the expiration date from table that's being inspected?

jyan3_0-1749656422257.png

 

edit 2: currently trying this, but the filter doesn't appear to be doing anything, but it no longer errors. it just returns the entire table to my next foreach step

var targetDate = new GlideDateTime();
targetDate.addDaysUTC(90);
var targetDateStr = targetDate.getDate().getByFormat("yyyy-MM-dd");

return "active=true^warranty_expirationON" + targetDateStr + "@javascript:gs.dateGenerate('" + targetDateStr + "', '00:00:00')";

 

 

 

jyan3_1-1749656604451.png

 

Edit: Tried the following code, but still doesn't seem to work

var expDate = fd_data._1__look_up_records.records.warranty_expiration

var gdt = new GlideDateTime();
gdt.addDays(90);
if(expDate == gdt)
{return true;}
else
{return false;}
 

 

1 ACCEPTED SOLUTION

jyan3
Kilo Guru
// Get the target date: 90 days from today
var startDate = new GlideDateTime();
startDate.addDaysUTC(90);

// Clone and set to the next day for the upper bound
var endDate = new GlideDateTime(startDate);
endDate.addDaysUTC(1);

// Format both dates
var startStr = startDate.getValue(); // full UTC date-time string
var endStr = endDate.getValue();

return "active=true^warranty_expiration>=" + startStr + "^warranty_expiration<" + endStr;

View solution in original post

1 REPLY 1

jyan3
Kilo Guru
// Get the target date: 90 days from today
var startDate = new GlideDateTime();
startDate.addDaysUTC(90);

// Clone and set to the next day for the upper bound
var endDate = new GlideDateTime(startDate);
endDate.addDaysUTC(1);

// Format both dates
var startStr = startDate.getValue(); // full UTC date-time string
var endStr = endDate.getValue();

return "active=true^warranty_expiration>=" + startStr + "^warranty_expiration<" + endStr;