cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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!

10 REPLIES 10
GarethPrisk
Resident Rockstar
Resident Rockstar

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.

Anonymous
Not applicable

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
Resolver II
Resolver II

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

 

Hi , I have the same problem, after book my Room I'm receive email confirmation with bad information "mercredi 23 juin 2021 06:00-10:00 (UTC) Temps universel coordonné " for UTC+02 PARIS.

chtz01
Regular Visitor

I have the same issue. Has anyone found a solution?

leslie_rivera
Resolver II
Resolver II

On the ConfirmationScreen OnVisible property I had to specify my time zone.

 

If(
IsBooking,
UpdateContext({ShowLoading: true});
If(
!BookForMeeting,
Office365.V4CalendarPostItem(
MyCalendar,
User().FullName & "'s Booking",
StartDateTime,
EndDateTime,
"Mountain Standard Time",
{
requiredAttendees: RoomsGallery.Selected.Email,
location: RoomsGallery.Selected.Name,
importance: "normal",
showAs: "Free"
}
),
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
);
Set(
OriginalBody,
Office365.V3CalendarGetItem(
MyCalendar,
MeetingsGallery.Selected.Id
).body
);
Office365.V4CalendarPatchItem(
MyCalendar,
MeetingsGallery.Selected.Id,
If(
MeetingsGallery.Selected.Subject = User().FullName & "'s Zoom Meeting",
User().FullName & "'s Booking",
MeetingsGallery.Selected.Subject
),
StartDateTime,
EndDateTime,
"Mountain Standard Time",
{
requiredAttendees: RequiredAttendeesTrue,
optionalAttendees: MeetingsGallery.Selected.OptionalAttendees,
body: OriginalBody,
location: RoomsGallery.Selected.Name,
importance: "Normal",
showAs: "Busy",
isHtml: true
}
)
);
UpdateContext({ShowLoading: false})
);
Set(
IsBooking,
false
)

 

leslie_rivera_0-1632407383231.png

leslie_rivera_1-1632407393105.png

leslie_rivera_2-1632407399924.png

leslie_rivera_3-1632407406568.png

 

 

Hi @leslie_rivera and thank you for replying. Your solution did not work for me, but does your Auto-response sent by the room (resource mailbox) reflect the time in Mountain Standard Time?

leslie_rivera
Resolver II
Resolver II

@chtz01Yes the email responses are now showing Mountain Standard Time. I exported a copy of the app and attached below. You can import it into your environment and review it and make any necessary changes to it. IT took me months to build out but it works perfectly now.

Here are directions for importing a canvas app package: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/export-import-app

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,732)