cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
New Member

Re: Leave Request Template - Crash bug

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
Highlighted
Regular Visitor

Re: Leave Request Template - Crash bug

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.

Highlighted
Community Support
Community Support

Re: Leave Request Template - Crash bug

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.
Highlighted
Regular Visitor

Re: Leave Request Template - Crash bug

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

Will be waiting for your notification.

Highlighted
New Member

Re: Leave Request Template - Crash bug

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

Highlighted
Super User
Super User

Re: Leave Request Template - Crash bug

>>

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.

Highlighted
New Member

Re: Leave Request Template - Crash bug

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.

Highlighted
Regular Visitor

Re: Leave Request Template - Crash bug

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.

Highlighted
Super User
Super User

Re: Leave Request Template - Crash bug

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

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,232)