web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Determining Asset avai...
Power Automate
Suggested Answer

Determining Asset availability for flow

(0) ShareShare
ReportReport
Posted on by 27
Hello,
 
After demonstrating the Bookings app to facilitate the booking of assets to my bosses, they were impressed but wanted other information to be captured which sits outside the scope of Bookings.
My organisation is very new to the Power platform and hasn't allowed Power Apps to be rolled out yet, otherwise I would have made an app to do the asset booking.
 
So, I am left with using Forms to collect the information from the user. I have a flow that captures data from the form and populates a bookings Sharepoint List. 
 
We have 5 laptops that can be booked out within our department, this could be increased to 30 across the organisation. The details of these laptops are held on laptops Sharepoint List.
 
The flow checks some information and based on compliance auto approves or flags for review.
 
Once the flow is auto approved or done manually, I want the flow to then select an available laptop. Availability will be based on columns 'Laptop required from' 'Laptop required until' and 'Allocated Laptop' columns  on the bookings list. 
 
I understand that the flow will have to look at the dates of the current booking, discount any that will be booked out on those dates and return the value of a laptop that is available (or return that none are available - very unlikely but has to be considered.
 
I've watched a few videos and scoured this and other forums but at a bit of a loss on how to get this part of the flow to work.
 
Example:
Name dateFrom dateUntil Approved Laptop
John Smith 25/12/24 26/12/24 Yes LAP0001
Joe Bloggs 21/12/24 28/12/24 Yes LAP0002
Florence Nightingale 23/12/24 25/12/24 Yes ???????
 
The third request is the one which requires a Laptop allocated. As the request dates conflict with previous bookings for LAP0001 and LAP0002, only LAP0003, LAP0004 and LAP0005 are available so one of those needs to be selected by the flow. Once this has been done, the flow will email the details to the user, which I am comfortable composing.
 
KRs : )
 
Categories:
I have the same question (0)
  • Suggested answer
    abc 123 Profile Picture
    789 Moderator on at
    Since you can't find a non-existent booking, you must solve by the inverse. For each laptop, find an existing conflicting booking that would exclude it from being able to be booked for the requested timeframe.
     
    (RequestedStart >= BookingBegin AND
    RequestedStart <= BookingEnd)
    OR
    (RequestedEnd >= BookingBegin AND
    RequestedEnd <= BookingEnd)
     
    PSEUDOCODE
    -----------------
     
    Parameters:
      pdtmBegin
      pdtmEnd
      pstrEmail
     
    Variables:
      booIsAvailable - Boolean: True
      booHasBeenBooked - Boolean: False
     
    Get Items Laptops (All)
    For Each Laptop
       Condition: booHasBeenBooked = False //Prevent booking more than one
       Yes:
          Set Variable booIsAvailable = True //Assume it can be used until proven false
          Get Items Bookings (For current laptop, use criteria above for the filter.)
          For Each Booking
            //By virtue of the fact that an existing booking was returned, set to False
            Set Variable: booIsAvailable = False
          //End For Each Booking
          Condition: booIsAvailable = True
             Yes: Create new Item
                    Send booking email
                    Set Variable: booHasBeenBooked = True
          //End Condition: booIsAvailable
    //End For Each Laptop
     
    This code has no provision for optimization/exceptions. For example, if one user returns a laptop earlier or later than booked. Or, perhaps after each booking, the IT department needs to perform maintenance.
     
    You could easily ignore any booking returned early, but one that is returned late can cause severe havoc. So, be sure to implement a routine to reallocate resources when this occurs.
     
    Writing the ODATA in the GetItems isn't easy nor intuitive. Feel free to ask specific questions about it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 77 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 68

#3
Expiscornovus Profile Picture

Expiscornovus 56 Most Valuable Professional

Last 30 days Overall leaderboard