Showing results for 
Search instead for 
Did you mean: 
New Member

Is my idea possible? Power apps button to automate email using sharepoint list data and also delete list entries

Hi everyone,


I'm a beginner in Power Apps, building my first app currently. I'm hoping someone can advise if the below scenario is possible, I've watched Shane Young's video showing how to send emails upon a button being selected, but I have a particular instance that seems quite complicated (to me) and would love to know if this is simply possible before my brain melts trying to piece together the code for this.

App Background

In my 'vehicle booking tool', I have SharePoint lists for 1) the fleet of vehicles, 2) user bookings for those vehicles, 3) driver/logbook entries for those vehicles. The app reads the user's O365 credentials to register who they are when the book a vehicle/record a logbook entry. 

I have a 'admin' function set up where only selected users (based on a SharePoint list) can see a button called 'Off Road'. I wish to make it so - when this button is selected for a particular vehicle, this button then notifies all users who have a booking for this vehicle (within a set amount of days preferably) that there is an issue with the vehicle and they need to book another vehicle. I would also like this button to automatically delete all booking entries in the list that are inclusive within the x amount of days as mentioned above. To then make it simpler, I may just advise the user marking the vehicle 'off road' to then book the vehicle themselves for the required amount of days until this is repaired. 


Has anyone used a similar function in their apps previously, or know if this is possible? 

Any advice/responses are much appreciated.


Thanks, Ross

Community Support
Community Support

Hi @Ross1111 ,


Could you please share more details about your scenario? Do you want to send Emails to those who booked the vehicle in a period to inform them the status and then delete the booking entries of that vehicle in that period?


If you do, you could try below formula:


Office365Outlook.SendEmailV2(Concat(Filter(bookings,vehicle=ThisItem.Name,StartTime > Now() && EndTime < Date(Today()+5)),User.Email,";"),"There is an issue with the vehicle and you need to book another vehicle.","There is an issue with the vehicle and you need to book another vehicle."&Char(10)&"This vehicle would be avaiable in 5 days",{Importance:"High"});Remove(bookings,Filter(bookings,vehicle=ThisItem.Name , StartTime > Now() , EndTime < Date(Today()+5)))


Since you didn’t provide the details about the lists, I assume that the booking records are with columns of user(Person type), vehicle (LookUp type), start time and end time (Date and Time type). This formula would send emails to users who booked a selected vehicle in the period of 5 days from now on. Then the entries would be deleted.


Please have a try, and if you have further information about the list or your scenario, please let me know.


Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

@v-jefferni - thank you for replying. 

Apologies if my query was vague/lacked detail. I will try what you said, but also leads to another query. 


List  2 from my initial post (vehicle bookings) contains driver (email), reg, date  & time for from  & to as you correctly guessed.


I also have a list of vehicles (list 1 in my post). This contains details of the vehicle (reg, make, model etc) and when booking a vehicle, it is set up so when a from/to time and date are selected, it filters in a gallery of ‘available vehicles’ to book, based on the return of all vehicles in List 1 that are not in List 2. 


Is there an way to incorporate a toggle button/something of this sort - to remove vehicle from the search results within ‘available vehicles’ until the admin user deselects this button? (Marking it off road/then on road essentially). I would like to have this as an open timeline, using your suggestion above as well for the bookings already made. 

Thank you. 

Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.


Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

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
Top Kudoed Authors
Users online (2,744)