cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Adding days to an existing date field

Hi,

I am trying to build a flow for a task list that recreate the tasks based on a specific frequency. I have tasks that are weekly, monthly, and so on. Since the tasks don't change, my flow just takes the existing tasks and recreate them while setting the status field to outstanding and adding, for example, 7 days to the due date for a weekly task. In the images you can see that I am telling my flow to filter for only items that are created in the past 7 days to avoid  recreating the same task more than once, since the same task gets recreated every week but just with a different due date. However, I can't seem to be able to find an addDays formula that works for this specific case and tried all the solutions given to similar cases online. I think this might be due to using the Get Items action which limits the dynamic fields available to insert in the addDays formula, but I don't know any work around. I would appreciate any help!

Thanks in advance,

1.PNGimage.png3.PNG4.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Adding days to an existing date field

Hi @Power_Aissam, one way to tackle this is to have a column in your list to check whether it is that item that gets renewed as a new task or not. I've called this column Renew with a default value of Yes.

Then in the condition we check whether the item in the list was created within the last 7 days: Created is greater than addDays(utcNow(),-7) and also add a row to the condition that Renew is equal to Yes

If Yes (the green channel) we:

  • update the current item in the list and change the Renew to No.
  • create a new item with the Renew set to Yes.
  • In the column for the due date we add an expression which adds 7 days to the updated (i.e original item) date using addDays(body('Update_item')?['Created'],7) 

This is all shown in the images below.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

1-Condition.png2-UpdateCreate.png3-SPList.png

 

 

 

 

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Adding days to an existing date field

Hi @Power_Aissam, one way to tackle this is to have a column in your list to check whether it is that item that gets renewed as a new task or not. I've called this column Renew with a default value of Yes.

Then in the condition we check whether the item in the list was created within the last 7 days: Created is greater than addDays(utcNow(),-7) and also add a row to the condition that Renew is equal to Yes

If Yes (the green channel) we:

  • update the current item in the list and change the Renew to No.
  • create a new item with the Renew set to Yes.
  • In the column for the due date we add an expression which adds 7 days to the updated (i.e original item) date using addDays(body('Update_item')?['Created'],7) 

This is all shown in the images below.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

1-Condition.png2-UpdateCreate.png3-SPList.png

 

 

 

 

View solution in original post

Frequent Visitor

Re: Adding days to an existing date field

Hi @RobElliott 

 

I keep getting this error message with the addDays expression I think. My DueDateW format on the sharpoint list is Date & Time though..

1.PNG

Highlighted
Super User III
Super User III

Re: Adding days to an existing date field

You'll need to post an updated screenshot of your flowsowe can seewhat's happening.

Rob

Los Gallardos

Highlighted
Frequent Visitor

Re: Adding days to an existing date field

Hi @RobElliott ,

 

I was able to figure out. I just deleted my column and recreated a new one and it worked.

 

Thanks,

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,186)