cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Power_Aissam
Level: Powered On

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

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

 

 

 

 

4 REPLIES 4
Super User
Super User

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

 

 

 

 

Power_Aissam
Level: Powered On

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

Super User
Super User

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

Power_Aissam
Level: Powered On

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

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 111 members 4,018 guests
Please welcome our newest community members: