Help with Workflow timer (30 days + X days)

Brett21
Tera Guru

Community,

My current workflow is set to generate tasks 30 days after request is submitted.  The customer is now allowing users to select extended days beyond the automatic 30 days.  I am not sure how to update the workflow timer to include the extended days variable.  Any assistance will be helpful.

 

var endTimeValue = current.variables.idServerPoweredDown;  //new variable for users to extend x days beyond 30 automic days.
var now = gs.nowNoTZ();
var endTime = new GlideDateTime(now);
endTime.addDaysLocalTime(30);
var diff = gs.dateDiff(now, endTime, true);
answer = diff;

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

If endTimeValue is number of days then simply this should work

 

var endTimeValue = current.variables.idServerPoweredDown;  //new variable for users to extend x days beyond 30 automic days.
var now = gs.nowNoTZ();
var endTime = new GlideDateTime(now);
endTime.addDaysLocalTime(30 + endTimeValue);
var diff = gs.dateDiff(now, endTime, true);
answer = diff;

 

-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

If endTimeValue is number of days then simply this should work

 

var endTimeValue = current.variables.idServerPoweredDown;  //new variable for users to extend x days beyond 30 automic days.
var now = gs.nowNoTZ();
var endTime = new GlideDateTime(now);
endTime.addDaysLocalTime(30 + endTimeValue);
var diff = gs.dateDiff(now, endTime, true);
answer = diff;

 

-Anurag

Anurag thank you.  I just added this to my workflow and will do a test to see what happens tomorrow.

Thank you Anurag, my testing was successful.