Help

Re: Change due date to the friday before - if it falls on a sat or sun

1024 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Alix
5 - Automation Enthusiast
5 - Automation Enthusiast

Is there a script or automation I could use - if due date is saturday or sunday, change due date to friday before?

Thanks!

1 Reply 1
KVachon
6 - Interface Innovator
6 - Interface Innovator

You can do this using a few formulas instead of an automation if you’d like.

Here is a formula that could change the date (we’ll call it Calculated Date):

IF({Due date field}="",{Due date field},DATEADD({Due date}, 
      SWITCH(WEEKDAY({Due date field}), 0, -2, 6, -1, 0),'days'))

If you’d like to do it with automation to update the existing due date field automatically, you could do it a few ways:

With a helper column in your table using the field you just created above and one additional helper column (we’ll call this Date Check)

IF({Due date field}={Calculated date},"Yes","No")
  1. Create an automation to check “When a record matches a condition.”
  2. Select the table
  3. Add a condition that checks if your Date Check field is equal to “No”.
  4. Select an action to Update Record
  5. Choose your table (same as above)
  6. Select your record ID from step 1
  7. Choose your Due date field
  8. Set the field to be dynamic by clicking on the gear icon to the right
  9. Choose your Calculated date field

The benefits to using the additional columns (3 total: Your original Due Date, Calculated Date, & Date Check) is that it limits the need for addition views that an automation that would be dependent on it to run successfully. Additionally, this achieves the same process if you wanted to use a script, just a bit easier.

Hopefully that helps!