cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Power_Aissam
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
RobElliott
Super User
Super User

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
RobElliott
Super User
Super User

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

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

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

Rob

Los Gallardos

Power_Aissam
Frequent Visitor

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,165)