cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RoxanneO
New Member

Book a Room template Time Zone Issue

Good day, we are currently using the "Book a Room" PowerApp. Please can I have some assistance:

1) Time Zone - We are in South Africa (therefore South Africa (GMT+2)) I have searched the forums and there hasn't been a successful solution offered as yet. When booking a room through the app, the time zone is correct, and upon reaching the confirmation page the time reflected is correct as per our timezone. The calendar invite in the User's diary, as well as the Room's diary is correct as per our timezone, however the Auto-response sent by the room (resource mailbox) reflects the time in UTC. Please can you assist in providing steps whereby I can correct this.

 

Assistance would be greatly appreciated!

4 REPLIES 4
GarethPrisk
Super User II
Super User II

Hadn't looked at this Template before, but this question made me curious.

Unfortunately, this is not their best example of a well-coded app, and is also a bit dated. For the examples below, I am using the control and screen names that are included with the template.

To resolve your issue, here's what you'll want to explore:

  • (Button9) button
    • Sets a global variable (IsBooking) to True
    • Navigates to (ConfirmationScreen) screen
  • (ConfirmationScreen) screen
    • The OnVisible property of this screen it actually creating the event
    • If the global variable is True, it creates an event
      • This is problematic because in the Studio it will execute this function when you navigate to the screen, creating duplicate events
      • There are a number of better patterns for this, but it will work in most cases
    • Review the function here and adjust as needed; notes below

 

At a glance, the formula is not passing a TimeZone parameter. If you provide this with the correct timezone, then it should create the event correctly. Example below (the annotated portions were updated).

 

If(
    IsBooking,
    UpdateContext({ShowLoading: true});
    If(
        !BookForMeeting,
        Office365.V4CalendarPostItem( // Using new connector
            MyCalendar,
            User().FullName & "'s Booking",
            StartDateTimeUTC,
            EndDateTimeUTC,
            "Not sure what this is, but add SA timezone", // Added timezone            
            {   
                requiredAttendees: RoomsGallery.Selected.Email, // Mapped to new param name
                location: RoomsGallery.Selected.Name, // Mapped to new param name
                importance: "Normal", // Mapped to new param name
                showAs: "Busy" // Mapped to new param name
            }
        ),
        ClearCollect(
            RequiredAttendeesNoRoom,
            Split(
                MeetingsGallery.Selected.RequiredAttendees,
                ";"
            )
        );
        ForAll(
            AllRooms,
            RemoveIf(
                RequiredAttendeesNoRoom,
                Address = Result
            )
        );
        ClearCollect(
            RequiredAttendeesNoRoom,
            Concat(
                RequiredAttendeesNoRoom,
                Result & ";"
            )
        );
        ClearCollect(
            RequiredAttendeesNoRoom,
            Split(
                First(RequiredAttendeesNoRoom).Value,
                ";;"
            )
        );
        Set(
            RequiredAttendeesFinal,
            First(RequiredAttendeesNoRoom).Result
        );
        Set(
            RequiredAttendeesTrue,
            RoomsGallery.Selected.Email & ";" & RequiredAttendeesFinal
        );
        Office365.V2CalendarPatchItem(
            MyCalendar,
            MeetingsGallery.Selected.Id,
            If(
                MeetingsGallery.Selected.Subject = User().FullName & "'s Skype Meeting",
                User().FullName & "'s Booking",
                MeetingsGallery.Selected.Subject
            ),
            StartDateTimeUTC,
            EndDateTimeUTC,
            {
                RequiredAttendees: RequiredAttendeesTrue,
                OptionalAttendees: MeetingsGallery.Selected.OptionalAttendees,
                Body: "Room has been updated to " & RoomsGallery.Selected.Name,
                Location: RoomsGallery.Selected.Name,
                Importance: "Normal",
                ShowAs: "Busy"
            }
        )
    );
    UpdateContext({ShowLoading: false})
);
Set(
    IsBooking,
    false
)

 

Update:

- I am not sure what the timezone parameter expects, so updated my example

 

Formula bar to the rescue!
If you have a blank in the TimeZone parameter, it will show expected values.

GarethPrisk_0-1607095369514.png

 

"(UTC+02:00) Harare, Pretoria" will work for you.

RoxanneO
New Member

Good day Gareth, apologies for the delay in response, I had another urgent project to attend to and never got a chance to test your code before now. I have made the changes as you suggested, however now the calendar events are no longer being created. Do I need to change the code in other places other than the ConfirmationScreen OnVisible property?

leslie_rivera
Helper III
Helper III

I am having the same issue. The app shows the correct time zones but the confirmation email shows in UTC. I tried the suggestions above but that didn't work. I need it to show in Mountain Time Zone. UTC-07:00. Can anyone help???

 

leslie_rivera_0-1620768703545.png

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (25,071)