I would like my workflow in SP Designer 2013 to only run if it is within 7 days of my column [Hire Date], otherwise, pause until that date. I see how to create the column if it is exactly 7 days from the hire date, but if the item is created 3 days before, I'd like it to run as well. I need a statement like "If t[Current Date] is 7 days or fewer from [Hire Date] then start workflow, Else, pause until 7 days before. My current column is =DATE(YEAR([Hire Date]),MONTH([Hire Date]),DAY([Hire Date])-7) How can I make it "or 6,5,4,3,2,1" days?
3 Answers
A possible way of doing this would be:
Within your workflow create a local variable called "PauseUntilDate", and get its value as
PauseUntilDate = Hire Date - 7 days
Next write a pause until statement to make the workflow wait until "PauseUntilDate"
If the "PauseUntilDate" is yet to come, the workflow will begin execution on the designated date.
If the "PauseUntilDate" has already passed, the workflow will realize this within about 5 minutes and run the next statement.
And of course, delete the calculated column, you don't need it anymore.
-
Where do I add the value to the local variable? I don't think I've run into that before. Can I do that out-of-the-box with SharePoint Designer 2013?– markaseyApr 16, 2016 at 0:46
-
Have a look at this: sharepoint.stackexchange.com/a/144674/51055 The answer explains how you calculate dates with SP designer. In your case the calculation is quite simple. Apr 16, 2016 at 3:32
-
Maybe this is clearer: First, use the "Add time to date" action, with
Add -7 days to [Hire Date]
output to variablePauseUntilDate
, thenPause until
action withPauseUntilDate
variable.– Erin LApr 18, 2016 at 18:50 -
Variables will solve your problem:
- First you should make a Variable call (-7Day) which is Hire Date-7. (which is the exact start date)
- make your work flow on this condition:
IF [Current Time] equal or greater than [-7DAY]
- then the actions which you need to be done in next step
You can try making the workflow pause based on a boolean field calculated with following formula;
=IF((DATEDIF([Hire Date], Today(),"d") <= 7),"")
Read more about principals used here
and
Please Note: This solution will only work if workflow is triggered on item create or item update.
-
2[Today] will not do what you expect it to do: sharepoint.stackexchange.com/questions/151144/… Apr 15, 2016 at 19:28
-
I'm receiving an error on the [Today] part. Should I be replacing that with a variable?– markaseyApr 15, 2016 at 22:16
-
Thanks Danny-- I just saw your comment after I posted mine. I'll check out that link.– markaseyApr 15, 2016 at 22:17
-
@DannyEngelman excellent link. Thank you. I didn't try the formula before posting hte answer. Edited to remove the [Today] dependency. Apr 16, 2016 at 21:10
-
1In your answer you now replaced [Today] with Today(), which has the same issue. It will only re-calculate (to todays date) when you edit the Item or Formula. Unlike Excel it is not Todays date in Views: sharepoint.stackexchange.com/questions/151144/… Apr 17, 2016 at 9:55