cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerUser2020
Regular Visitor

Leave Request Template - Crash bug

Hello all,

 

I am in process of creating a leave request through PowerApps, I've installed the template available, but when I publish the template.. If I login as a Manager, the app crash. However, if I log in as an Employee first, and then switch to Manager the app runs flawlessly.

 

I've noticed this bug available only in Tablet view, anyone found a fix for this? Will appreciate any help provided!

 

How to reproduce this?
Create New Leave Request template (Tablet view) -> Save and Publish -> Run the app using the link provided after publishing -> Click "Log in as a Manager"

1 ACCEPTED SOLUTION

Accepted Solutions
JustToHelp
New Member

This issue with the login-first-as-Manager in the Leave Request template comes from the AllItems property for galleries. It is used twice with CountRows() and gives a wrong value of zero resulting in a crash followed by empty galleries.

 

The workaround is to replace, in CounRows(), the AllItems by the initial filter used in the gallery's Items property.

 

For instance, for GalleryRequests change the Visible property:

 

CountRows(GalleryRequests.AllItems) > 0

 

To:

 

CountRows(
If( _requestTFilter="All",
Filter('Leave Requests', If(_managerView, Approver = _myProfile.UserPrincipalName, Requester = _myProfile.UserPrincipalName)), 
Filter('Leave Requests', Status=_requestTFilter && If(_managerView, Approver = _myProfile.UserPrincipalName, Requester = _myProfile.UserPrincipalName)) )
) > 0

 

 

The other one to modify is in the Height property of GalleryRequestDetails:

 

CountRows(GalleryRequestDetails.AllItems)*75

 

Et voila, the crash should not happen after that.

 

Also, unrelated issues but worth to know, _requestTypeFilter should be replaced by _requestTFilter, or vice-versa. Timers are also screwing the whole thing up. Remove them and use the SetFocus() in the HomeScreen OnVisible property:

 

Switch(_requestTFilter, "All", SetFocus(Button2), "Approved", SetFocus(Button2_2), "Pending", SetFocus(Button2_1), "Declined", SetFocus(Button2_3))

 

 

 

View solution in original post

8 REPLIES 8
PowerUser2020
Regular Visitor

Checked most code lines in 'Log in' page and 'Homepage' without any luck. The app doesn't crash when debugging locally, it only crashes when opened via URL link.

v-xida-msft
Community Support
Community Support

Hi @PowerUser2020 ,

Actually, there are some known issue with this "Leave Request" template app -- When you generate an app based on the "Leave Request" template app, it would cause some issues which would be prompted with the "App checker" option as below:

1.JPG

So firstly, you need to fix these known issues within this generated template app firstly, and then publish this app.

 

Within this template app, it would use the Concurrent function in many places, but the important thing you need to know is that -- Use of functions that can change the screen or exit the app is not allowed within the Concurrent function.

2.JPG

So you need to move the Navigate() function, Back() function or Exit() function outside the Concurrent function. For above screenshot issue, you should modify the OnSelect formula to following:

Concurrent(
    Set(_selectedApprover, ThisItem),
    Set(_selectedApproverPhoto, Office365Users.UserPhoto(ThisItem.Id))
);
Back()

 

I have made a test on my side, and the issue is confirmed on my side. I think this issue is related to published version of "Leave Request" template app, I would post this issue to my Product Team, if this issue is fixed, I would reply here.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for prompt reply, looking forward for this issue to be fixed.

Will be waiting for your notification.

JustToHelp
New Member

This issue with the login-first-as-Manager in the Leave Request template comes from the AllItems property for galleries. It is used twice with CountRows() and gives a wrong value of zero resulting in a crash followed by empty galleries.

 

The workaround is to replace, in CounRows(), the AllItems by the initial filter used in the gallery's Items property.

 

For instance, for GalleryRequests change the Visible property:

 

CountRows(GalleryRequests.AllItems) > 0

 

To:

 

CountRows(
If( _requestTFilter="All",
Filter('Leave Requests', If(_managerView, Approver = _myProfile.UserPrincipalName, Requester = _myProfile.UserPrincipalName)), 
Filter('Leave Requests', Status=_requestTFilter && If(_managerView, Approver = _myProfile.UserPrincipalName, Requester = _myProfile.UserPrincipalName)) )
) > 0

 

 

The other one to modify is in the Height property of GalleryRequestDetails:

 

CountRows(GalleryRequestDetails.AllItems)*75

 

Et voila, the crash should not happen after that.

 

Also, unrelated issues but worth to know, _requestTypeFilter should be replaced by _requestTFilter, or vice-versa. Timers are also screwing the whole thing up. Remove them and use the SetFocus() in the HomeScreen OnVisible property:

 

Switch(_requestTFilter, "All", SetFocus(Button2), "Approved", SetFocus(Button2_2), "Pending", SetFocus(Button2_1), "Declined", SetFocus(Button2_3))

 

 

 

View solution in original post

>>

It is used twice with CountRows() and gives a wrong value of zero resulting in a crash followed by empty galleries.

The workaround is to replace, in CounRows(), the AllItems by the initial filter used in the gallery's Items property.

For instance, for GalleryRequests change the Visible property:

CountRows(GalleryRequests.AllItems) > 0

<<

Is this crash when using CountRows on a Gallery's AllItems property widespread? Just happened on this thread and have an inherited App which is sometimes crashing (in a browser, the screen goes white, loading spinner appears then the App starts again but has odd artifacts like changed fonts), pretty sure the App uses some CountRows on gallery.AllItems.

Your description of the crash is similar to what happens in the Leave Request template. I found the issue in a post from a Powerapps staff in 2017:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Bug-with-gallery-checkbox-and-CountRows/m-p/...

I guess that this is still an open issue. Please try this workaround in your app and let us know if it fixes the crash.

THANKS A LOT, DEAR!

This is exactly what I was looking for!
It is a shame that Microsoft released this template with these many bugs and errors.

@JustToHelp  Didn't fix the crashes in may App unfortunately, but was well worth a try.

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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,608)