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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Book A Room Template -...
Power Apps
Unanswered

Book A Room Template - Once room is booked, I need room to either be hidden or disabled for that time-slot.

(0) ShareShare
ReportReport
Posted on by

 

Hello all,

 

I am using the Microsoft Book A Room template, and one thing I've noticed is that when I book a room, it doesn't remove the room from the Gallery. However, if I try to book the same room twice, it will send an email to my email address saying that the room was unable to be booked since it was previously booked.

 

My goal is to remove (or hide/disable) the room from the Gallery once it's booked ... so that other people don't get confused by seeing a room that has been booked in their Gallery displaying all rooms available. 

 

This is the code that I have in the OnSelect of my 'Book' button:

 

jharville_0-1628032047099.png

 

So for example, if I select the 'Book' button next to the "Deck 1" room, I want the room to be deleted from the Gallery for that time-slot, or hidden/disabled in the Gallery for that time-slot.

 

Thank you!

 

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    I had a quick look at this template, and assuming you haven't modified it much, it uses internal collections for most of the data handling. That gives you the option of re-generating the collections that query the Office 365 connector for available rooms. To do that you can put this series of ClearCollect functions in the OnSelect of a button named Refresh:

    ClearCollect(AvailableRooms, Office365.FindMeetingTimes({RequiredAttendees: AllRoomsConnector, IsOrganizerOptional: true, Start: StartDateTimeUTC, End: EndDateTimeUTC, MeetingDuration: DateDiff(StartDateTime, EndDateTime, Minutes), MinimumAttendeePercentage: "1", ActivityDomain: "Unrestricted"}));
    
    ClearCollect(AvailableRoomsSorted, SortByColumns(First(AvailableRooms).MeetingTimeSuggestions, "Confidence", Descending));
    
    ClearCollect(AvailableRoomsConcat,Concat(Filter(First(AvailableRoomsSorted).AttendeeAvailability, Availability = "Free"), Attendee.EmailAddress.Address, ","));
    
    ClearCollect(AvailableRoomEmails, Split(First(AvailableRoomsConcat).Value, ","));
     
    ClearCollect(AvailableRoomEmailName, AddColumns(RenameColumns(AvailableRoomEmails, "Result", "Email"), "Name", LookUp(AllRooms, Email = Address).Name));

    Hope that helps!

     

  • jharville Profile Picture
    on at

    @BCLS776 

     

    Thank you for providing the code, I really do appreciate it. I tried adding it to my app and it errored out, so I'll be working on it over the next few days to see if I can get it to be functional.

  • jharville Profile Picture
    on at

    @BCLS776 

     

    I have a quick question. Would you know why this error is coming up? I've been messing around with it for awhile and still haven't been able to get rid of the error:

    jharville_0-1628531398364.png

     

    I tried removing the red-underlined portion of code, and it got rid of the errors, but the room didn't disappear from the Gallery once it was booked.

     

    Thank you, I really appreciate your time and help.

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @jharville ,

     

    Instead of using clearcollect would you try Collect only in the error code ? 

  • BCLS776 Profile Picture
    8,994 Moderator on at

    Hmm, that still looks like a direct copy of the code that exists in the OnStart property of the app template, which is what we want to replicate. Could you check to make sure the statements just before the ClearCollect (I see an If(), but there may be others) are correctly terminated with a semicolon?

     

     

  • jharville Profile Picture
    on at

     

    Hello and thank you for the response. Unfortunately, using Collect() as an alternative still brings the same error:

     

    jharville_0-1628534584333.png

     

  • jharville Profile Picture
    on at

     

    I checked and the If() statement was correctly terminated with a semi-colon:

     

    jharville_1-1628534784568.png

     

    I temporarily removed the If() statement for testing, and still saw the same error as well:

     

    jharville_2-1628534832953.png

     

    Is it possibly referencing a variable that hasn't been instantiated yet? Or maybe something else?

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @jharville ,

    That clearly means there is issue with the variables you are passing. I would suggest to try commenting one field at a time to check which of the field value is creating the issue  

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 393

#2
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 271 Super User 2025 Season 2

Last 30 days Overall leaderboard