- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2021 04:18 PM
I have to add 1 day to a date field in flow designer and feed the new date into my powershell scripts.. so if date on my effective date is 08-27-2021 i need it to be set to 08-28-2021 in my flow, script below not working
any help would be great
var effectiveDate = fd_data.trigger.current.u_effective_date;
var gdt = new GlideDateTime(effectiveDate);
var newDate = gdt.addDaysLocalTime(1);
return newDate;
this does not work get an error:
Exception setting "Date": "Cannot convert null to type "System.DateTime"."
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2021 09:58 PM
had to rewrite the entire thing after getting undefined when i sent it to the logs.
var effectiveDate = fd_data.trigger.current.u_effective_date.getDisplayValue();
gs.info("EFFECTIVE DATE: " + effectiveDate);
var gd = new GlideDate();
gd.setValue(effectiveDate);
gd.addDaysLocalTime(1);
gs.info("NEW DATE: " + gd)
return gd;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2021 04:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2021 09:58 PM
had to rewrite the entire thing after getting undefined when i sent it to the logs.
var effectiveDate = fd_data.trigger.current.u_effective_date.getDisplayValue();
gs.info("EFFECTIVE DATE: " + effectiveDate);
var gd = new GlideDate();
gd.setValue(effectiveDate);
gd.addDaysLocalTime(1);
gs.info("NEW DATE: " + gd)
return gd;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 11:22 AM
Had to do this but with years! Worked GREAT! TY! use (gd.addYearsLocalTime)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2021 07:58 PM
Hello,
I do not believe you need to specify current when calling fd_data.trigger. Please try the following:
var effectiveDate = fd_data.trigger.u_effective_date.toString();
Hope this helps.
--David