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

Designing flow with multiple delays

Hello People,

 

I need help with a FLOW where i am trying to delete the blog after an year. The basis FLOW i have now waits till 365 days and then informs the owner to delete. This works well. However below are some of the scenarios i need to address to expand the scope.

 

1. If someone edits within 365 days, then the FLOW should not multiple emails. As this will confuse the owner

2. Also if a blog is deleted within 365 days, it should not send any mail

 

Any logic or steps to address these will be helpful.

 

Thanks,

 

Santosh

10 REPLIES 10
v-zhos-msft
Level 10

Re: Designing flow with multiple delays

Hi @Santosh_M ,

It seems you want delete the blog one year later.

I have made a flow for your scenario, please check it for a reference.

Capture1.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Santosh_M
Level: Powered On

Re: Designing flow with multiple delays


Thanks for the response. I forgot to add few more details. The Blog is based out of the SharePoint. Also i need to take care of the 2 scenarios as mentioned in my original post. I am unable to cancel the subsequest emails sent when an item is edited or deleted completely.
@v-zhos-msft wrote:

Hi @Santosh_M ,

It seems you want delete the blog one year later.

I have made a flow for your scenario, please check it for a reference.

Capture1.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


 

Super User
Super User

Re: Designing flow with multiple delays

Hi @Santosh_M, your best solution will not be to pause the workflow until a particular date but to use a Recurrence trigger to schedule a check for deletions on a daily basis. You could set up a daily trigger which will look for any blog posts which have been created/modified 365 days ago.

 

Recurrence Trigger: https://collab365.community/replace-scheduled-tasks-flow-recurrence/

 

Then you can use Get Items from the SharePoint actions to get the blog posts as they're just list items, and filter based on the created date or modified date, which ever makes most sense in your scenario.





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Santosh_M
Level: Powered On

Re: Designing flow with multiple delays


Hi Matt,

 

Thanks for the suggestion. However, we have a requirement to send an email with options after 365 days to delete the blog post. The owner will decide on deletion or retention.

 

As a novice to Flow, i coudnt understand how i can set both daily recurrence and 365 days check. Any inputs on this will be helpful.

 

@MattWeston365 wrote:

Hi @Santosh_M, your best solution will not be to pause the workflow until a particular date but to use a Recurrence trigger to schedule a check for deletions on a daily basis. You could set up a daily trigger which will look for any blog posts which have been created/modified 365 days ago.

 

Recurrence Trigger: https://collab365.community/replace-scheduled-tasks-flow-recurrence/

 

Then you can use Get Items from the SharePoint actions to get the blog posts as they're just list items, and filter based on the created date or modified date, which ever makes most sense in your scenario.



@MattWeston365 wrote:

Hi @Santosh_M, your best solution will not be to pause the workflow until a particular date but to use a Recurrence trigger to schedule a check for deletions on a daily basis. You could set up a daily trigger which will look for any blog posts which have been created/modified 365 days ago.

 

Recurrence Trigger: https://collab365.community/replace-scheduled-tasks-flow-recurrence/

 

Then you can use Get Items from the SharePoint actions to get the blog posts as they're just list items, and filter based on the created date or modified date, which ever makes most sense in your scenario.





Super User
Super User

Re: Designing flow with multiple delays

Thanks for replying @Santosh_M. One last question just so that I can shape the solution for you, would you have multiple blogs being published on the same day? Therefore having multiple retain/delete decisions on one day?





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Santosh_M
Level: Powered On

Re: Designing flow with multiple delays


Yes. We publish multiple blogs in a day. And all these blogs can be edited or deleted any day before a year.

 

@MattWeston365 wrote:

Thanks for replying @Santosh_M. One last question just so that I can shape the solution for you, would you have multiple blogs being published on the same day? Therefore having multiple retain/delete decisions on one day?


 

Santosh_M
Level: Powered On

Re: Designing flow with multiple delays


Hey Matt,

 

Any luck on this?

 

Thanks,

 

Santosh

@Santosh_M wrote:

Yes. We publish multiple blogs in a day. And all these blogs can be edited or deleted any day before a year.

 

@MattWeston365 wrote:

Thanks for replying @Santosh_M. One last question just so that I can shape the solution for you, would you have multiple blogs being published on the same day? Therefore having multiple retain/delete decisions on one day?


 


 

Super User
Super User

Re: Designing flow with multiple delays

Hi @Santosh_M apologies, I thought I'd replied.

 

What I would suggest is this type of Flow:

  • Trigger is a Recurrence trigger which runs once per day
  • Action: get Items from the Posts list on your Blog site which have a Created date of Today-365 (this day last year)
  • Control: For each item that gets return from Get Items (and I'm going to set concurrency on this so that I can handle multiple concurrent emails being sent out)
    • Action: Send an email with options
    • Condition: If Option 1 is selected I'm going to do something, else I'm going to do something else.

FlowOverview.PNG

In a bit more detail, the Trigger first of all. I am using the Recurrence Trigger and have configured it run once per day at 5AM

Trigger.PNG

 

I am then going to use the Get Items to go and fetch all fo the list items from my list where the creation date was 365 days ago. For that I use an expression, so Created (the created date) eq (is equal to) addDays(utcNow(),-365) (subtract 365 days from today)

Action - Get Items.PNG

 

Any results which we get back, we can the loop around and process:

Loop.PNG

 

We need to change the settings on the "Apply to each" loop so that we can run concurrently, otherwise your workflow will pause when it first sends out our email. Toggle the Concurrency control and move the slider based on how many concurrent runs you want. I've left it as the default.

Concurrency.PNG

Within my loop I'm going to use the action "Send email with options" to send out an email which will contain two options for the recipient to choose from: Retain, or Delete. The email will be sent to the user who has created the post, but this can obviously be changed to another field containing an email address as required.

 

Action - Get Items.PNG

Still within the loop, and directly below the Send email action, I'm going to create a condition to deal with the responses and when they come back in. I'm going to create a basic condition on whether the response is Retain. If you have more than two options, then you could change the condition for a switch control. All I'm going to do within this example, is push out a response to my Flow app so that I can see it has fired and that I'm getting the desired response, but you could change those actions to anything you wanted from that point.

Condition.PNG

 

I hope that gives you the answer your needed, if not please shout and I'll have another go Smiley Happy





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





santhosh_vm
Level: Powered On

Re: Designing flow with multiple delays


Hey Matt,

 

Thanks a bunch for putting this together. Thats lot of help. I recreated this at my end and found one issue as below. The "AddDays" is failing repeatedly. Below is the formula i have used. 

addDays(utcNow(),-365)

 

Below is the error message.  

The expression "2018-04-17T07:27:51.7883320Z" is not valid.
clientRequestId: 528730be-e9f3-48c5-a7b1-0b36fe08b0cc
serviceRequestId: ebc5d39e-903d-8000-5255-f53a5f9234e5

 

Please let me know if i need to do anything differently. 

 

Thanks,


Santosh

@MattWeston365 wrote:

Hi @Santosh_M apologies, I thought I'd replied.

 

What I would suggest is this type of Flow:

  • Trigger is a Recurrence trigger which runs once per day
  • Action: get Items from the Posts list on your Blog site which have a Created date of Today-365 (this day last year)
  • Control: For each item that gets return from Get Items (and I'm going to set concurrency on this so that I can handle multiple concurrent emails being sent out)
    • Action: Send an email with options
    • Condition: If Option 1 is selected I'm going to do something, else I'm going to do something else.

FlowOverview.PNG

In a bit more detail, the Trigger first of all. I am using the Recurrence Trigger and have configured it run once per day at 5AM

Trigger.PNG

 

I am then going to use the Get Items to go and fetch all fo the list items from my list where the creation date was 365 days ago. For that I use an expression, so Created (the created date) eq (is equal to) addDays(utcNow(),-365) (subtract 365 days from today)

Action - Get Items.PNG

 

Any results which we get back, we can the loop around and process:

Loop.PNG

 

We need to change the settings on the "Apply to each" loop so that we can run concurrently, otherwise your workflow will pause when it first sends out our email. Toggle the Concurrency control and move the slider based on how many concurrent runs you want. I've left it as the default.

Concurrency.PNG

Within my loop I'm going to use the action "Send email with options" to send out an email which will contain two options for the recipient to choose from: Retain, or Delete. The email will be sent to the user who has created the post, but this can obviously be changed to another field containing an email address as required.

 

Action - Get Items.PNG

Still within the loop, and directly below the Send email action, I'm going to create a condition to deal with the responses and when they come back in. I'm going to create a basic condition on whether the response is Retain. If you have more than two options, then you could change the condition for a switch control. All I'm going to do within this example, is push out a response to my Flow app so that I can see it has fired and that I'm getting the desired response, but you could change those actions to anything you wanted from that point.

Condition.PNG

 

I hope that gives you the answer your needed, if not please shout and I'll have another go Smiley Happy


 

Super User
Super User

Re: Designing flow with multiple delays

Ahhh I'd accidentally wiped my filter expression just before I took the screenshot.

 

Surround the date with single quotes '<expression>' so your filter will look like Created eq 'addDays(...)'





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

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!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

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: 40 members 4,440 guests
Please welcome our newest community members: