cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jonathan_chan20
Helper I
Helper I

Sending email when past due on returning an item

Hi there, I'm fairly new to Power Automate. I've created a PowerApp where a user can check out equipment items. When the user checks out an item, there is an option to state when they plan to return that item called "Planned date return"

 

In Power Automate how can I set up an email for 7 days past the users "planned date return" if they did not return it?

 

 

Thank you,

23 REPLIES 23
ScottShearer
Super User
Super User

@jonathan_chan20 

Where are you storing your data?

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
jonathan_chan20
Helper I
Helper I

Hi,

 

my data is all through Sharepoint

@jonathan_chan20 

See my example below.  Note the single quotes in my Filter Query.  Also, you need to use a column's internal name in your filter query which is probably planneddatereturn but it may not be.  If you have an error, go to the SharePoint list settings and click on the column name.  The internal name will be at the end of the URL following Filed=

image.png

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Thank you! I just gave that a try for notification of 1 day. So hopefully it triggers and sends the email out. I will report back on the status if it does or not

I have tried this exactly and it does not work unfortunately

@jonathan_chan20 

When you say that it dies not work, can you explain further?  Does it generate an error?  

Please post screen shots of your Flow along with shots of any error that is generated.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

When I say it does not work it does not send an email of a late return when I manually run the flow.

It gives back a "flow failed" error.

 

Here are screen shots of the error when I manually run it

 

jonathan_chan20_0-1638547761974.pngjonathan_chan20_1-1638547778897.png

 

Here is how I have my flow set up.

 

jonathan_chan20_2-1638547833551.pngjonathan_chan20_3-1638547850286.pngjonathan_chan20_4-1638547877640.png

 

Thank you,

365CornerDawid
Resolver III
Resolver III

Hi @jonathan_chan20 

1.) Are you sure that in your Get Items Fitler Query you did provide following expression:
addDays(utcNow(),-7,'yyyy-MM-dd') 
2.) In your Filter Query of the Get Items there is the mistake it should be DatePlannedReturn eq 'addDays(utcNow(),-7,'yyyy-MM-dd')'
3.) Last but not least the Loop in the Loop Apply to Each / Apply to Each 2 looks bizzare...
Try to remove this steps add one more time action to Send Email and then take dynamic content from Get items - it will add single loop and for each item it will deliver the email.
If you want to group that and send as one mail you should use Select + Create HTML table 

Hope this will help, 
If I have answered your question, please for other community members mark post as Solved.



I had to change from "-7" to "-5" . I initially wanted to send an email to the item borrower 7 days after they have not returned an item but I decided to go with 5. It appears that it is subtracting 5 days from today. I would need it to send an email 5 days after the planned date return

 

But I am still getting this error now when I test the flow

 

jonathan_chan20_0-1638553432401.png

 

This is how I have the flow currently after trying what you suggested

 

jonathan_chan20_1-1638553660956.pngjonathan_chan20_2-1638553689270.png

 

 

Still stuck, any ideas?

ScottShearer
Super User
Super User

@jonathan_chan20 

The error indicates an issue with your filter query.  First, you must add single quotes before and after the expression - see my example above.  In addition, you need to add a space after DatePlannedReturn.  Finally, you don't have an operator such as eq for equals (see my example above).

Here is a link for more info on filter queries.

 

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Hi @jonathan_chan20 

As per your screenshot:

365CornerDawid_0-1638950838525.png

Your Filter Query is still incorrect... Make sure that you have the valid expressio which should be then:
DatePlannedReturn eq 'addDays(utcNow(),-7,'yyyy-MM-dd')'

Note that you should have SPACE after DatePlannedReturn
then eq 
then SPACE

then '

then expressions for the date 

then ' 

Everything is important for Filter Query 

Thank you for that, It fixed the errors. The flow now runs, but I still do not get an email unfortunately

Thank you for that, It fixed the errors. The flow now runs, but I still do not get an email unfortunately

@jonathan_chan20 glad your are one step closer to the resolution, your Email is not delivered becasue of the incorrect configuration at this place:

365CornerDawid_0-1639036875528.png

 

What you need to do:
1.) Remove Both Apply to Each loops

2.) Add send email Action 

3.) Add to the Subject or Body your properties from get items (like ItemBorrowed DatePlannedReturn)

4.) That will add automatically loop for each ITEM from your Get items step

REMEBER that if you have 100 items it will deliver 100 emails to BorrowEmail

 

If this is not what you wanted to have one email with the update about all items let me know.

Cheers

Dawid

Yes that is how I have it but it is still not sending out an email. I'm using the "test" command and running the flow "manually". It says the flow ran successfully but I do not get an email. Here is how it is set up

 

jonathan_chan20_0-1639085224028.png

 

For the testing change the TO to your email and add BorrowEmail to the body of email content - you will see if the BrrowEmail is not empty 🙂
You can also attach the screenshot from the historical run 🙂

Good call on TO email sending it to me. I just changed it to my email for test, still getting nothing

 

jonathan_chan20_0-1639086091293.png

 

 

Here is the historical runs

 

jonathan_chan20_1-1639086128670.png

 

Show me the screenshot not with the time but with the execution, open the loop to display how many times it executed and what was in it 🙂

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,382)