- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2025 08:44 AM - edited ‎06-11-2025 12:49 PM
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?
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')";
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;}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2025 01:15 PM
// 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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2025 01:15 PM
// 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;