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"
Solved! Go to Solution.
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))
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.
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:
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.
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,
Thank you for prompt reply, looking forward for this issue to be fixed.
Will be waiting for your notification.
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))
>>
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:
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.
User | Count |
---|---|
160 | |
93 | |
81 | |
74 | |
58 |
User | Count |
---|---|
195 | |
169 | |
99 | |
95 | |
79 |