- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2024 02:44 PM
Hello -
I am trying to get a script to work in a Flow Designer flow, input variable. I just want to get the current date in the script and then add 60 days to it and return that value, however it keeps returning a null value.
Here is what I have for the script:
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2024 05:01 PM
Hi @jlaue ,
I think you should use GlideDateTime in these type of scenarios.
Snippet should be something like this-
(function() {
var gdt = new GlideDateTime();
gdt.addDaysLocalTime(60);
return gdt.getDate().toString();
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2024 03:43 PM
Are you creating a scripted action for this? If not were are you putting the script in flow designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2024 04:15 PM
Hi @jlaue - What are you doing with the date? You can return a string like this:
// Create an instance of GlideDateTime to get the current date and time
var gdt = new GlideDateTime();
// Add 60 days to the current date
gdt.addDays(60);
// Format the date
var date = gdt.getDate();
gs.info(date.getByFormat('dd/MM/yyyy'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2024 05:01 PM
Hi @jlaue ,
I think you should use GlideDateTime in these type of scenarios.
Snippet should be something like this-
(function() {
var gdt = new GlideDateTime();
gdt.addDaysLocalTime(60);
return gdt.getDate().toString();
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 06:51 AM
Thanks for the quick help!! I was able to utilize that script to get it to work: