Post

2 followers Follow
0
Avatar

Setting a Task Start Date to Monday

We have a project template that drives many other task's dates, through dependencies, via an 'Install Date' task.

Currently, when a new project comes over from Salesforce, we have a workflow rule that checks if a customer has specified a date and, if they have not, it recalculates the install date to our standard,  8-weeks from project submission.

The problem we have with this is that if the project comes through on a Thursday, the WFR counts out 8 weeks from the Start Date, which is also a Thursday.  However, our Install Date should always be a Monday.

Is there a way to count out 8 weeks from Start (or from 'Today', since the WFR runs on project creation), identify what day that is and if it's not a Monday, move it to the next Monday after that date?

Richard Mann Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hello Richard,

Could you please try setting the Start Day of the tasks in question to the following formula:

Today() +
Days(
    If(
         Case(
              Mod(
                   Floor(
                        DateDiff(Today(), Date(1901, 1, 1), "d")
                   ),
                   7
              ),
              4, 6,
              5, 7,
              6, 1,
              0, 2,
              1, 3,
              2, 4,
              3, 5,
              12345
         ) = 1,
         56,
         56 + (8 - Case(
                             Mod(
                                  Floor(
                                       DateDiff(Today(), Date(1901, 1, 1), "d")
                                  ),
                                  7
                             ),
                             4, 6,
                             5, 7,
                             6, 1,
                             0, 2,
                             1, 3,
                             2, 4,
                             3, 5,
                             12345
                        )
         )
    )
)

 

You can change Today() into $StartDate if you want the new Start Date to be calculated from Start Date instead of today.

You can change 56 (8 weeks) into some other number, e.g. 28 (4 weeks) if you so prefer.

Please let me know if this is helpful.

Roland Pumputis 0 votes
Comment actions Permalink