I'm new to Orchestrator so please forgive my ignorance...
I'm building a workflow that allows our users to create their own snapshots. We have a policy that snapshots can only be kept for a maximum of 3 days. My inputs would allow the user to select the number of days (I'm cool with using hours if it's easier) until the snapshot is automatically committed. How would I accomplish this? Is there a method to take the current date/time (at the time the workflow is run) and add X days (or hours) to schedule a task that commits the snapshot?
Alternatively, is there a way to present a calendar and only allow them to select up to 3 days from the current date?
Thanks for any contributions
Here's a snippet of code that will help you:
var now = new Date();
System.log("Now is: " + now);
var newDate = new Date();
newDate.setDate(now.getDate() + 3);
System.log("Now + 3 days is: " + newDate);
Sample Output:
[2014-03-19 19:00:55.473] [I] Now is: Wed Mar 19 2014 19:00:55 GMT-0400 (EDT)
[2014-03-19 19:00:55.474] [I] Now + 3 days is: Sat Mar 22 2014 19:00:55 GMT-0400 (EDT)
Here's a snippet of code that will help you:
var now = new Date();
System.log("Now is: " + now);
var newDate = new Date();
newDate.setDate(now.getDate() + 3);
System.log("Now + 3 days is: " + newDate);
Sample Output:
[2014-03-19 19:00:55.473] [I] Now is: Wed Mar 19 2014 19:00:55 GMT-0400 (EDT)
[2014-03-19 19:00:55.474] [I] Now + 3 days is: Sat Mar 22 2014 19:00:55 GMT-0400 (EDT)
Thank you Burke! This worked perfectly!