web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Leave Request Template...
Power Apps
Answered

Leave Request Template - Crash bug

(0) ShareShare
ReportReport
Posted on by 16

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"

Categories:
I have the same question (0)
  • PowerUser2020 Profile Picture
    16 on at

    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 Profile Picture
    Microsoft Employee on at

    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,

  • PowerUser2020 Profile Picture
    16 on at

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

    Will be waiting for your notification.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

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

     

     

     

  • PaulD1 Profile Picture
    2,914 on at

    >>

    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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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/66691/highlight/true#M27390

    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.

  • PowerUser2020 Profile Picture
    16 on at

    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.

  • PaulD1 Profile Picture
    2,914 on at

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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard