Skip to main content
Community site session details

Community site session details

Session Id : AfJVJJaxzJQVQYKC5zwyAm
Power Apps - Building Power Apps
Unanswered

PowerApps Code Sporadically Not Executing

Like (0) ShareShare
ReportReport
Posted on 16 Feb 2022 11:31:08 by

I'm noticing there are sporadic instances where button initiated commands will fail to execute in its entirety. The issue appears to be random and not tied to a specific error. I tried using Monitor to see if a portion of the code is failing but the portion that doesn't execute never shows up. See the code below as an example. While a portion of the code will execute as intended, another portion, say one of the Patch commands, will not. This throws off the entire workflow of the app. It's not limited to a specific portion of the code. It may be the first patch command that doesn't run in one instance but then the 2nd patch command doesn't run in another instance. There doesn't appear to be a specific pattern. 9/10 times the app works fine but I'm seeing more and more instances where something didn't execute as intended. This app is used by a large number of users (>500) and I didn't notice these problems when only used by a small number of users. Has anyone else run into similar issues? Any suggestions on a resolution?

 

 

 

Example code executed by button click:

 

Set(

    varLoading,

    true

);

Patch(

    Approvals,

    LookUp(

        Approvals,

        And(

            'Approval Role' = "EOS",

            SSDID = Value([@SSDID].Text),

            'Workflow Step' = "Initiation",

            Status = 1

        )

    ),

    {'Approval Date': Now()}

);

Patch(

    Approvals,

    LookUp(

        Approvals,

        And(

            'Approval Role' = "EOS",

            SSDID = Value([@SSDID].Text),

            'Workflow Step' = "Initiation",

            Status = 1

        )

    ),

    {'Approval Status': "Approved"}

);

ClearCollect(

    ApprovalInfo,

    All

);

Collect(

    ApprovalInfo,

    Filter(

        Approvals,

        'Workflow Step' = "Initiation",

        SSDID = Value([@SSDID].Text)

    )

);

If(

    Value(Label8.Text) = 0,

    Patch(

        'SSD List Master',

        LookUp(

            'SSD List Master',

            SSDID = Value([@SSDID].Text)

        ),

       {Status: "Approved"}

    )

);

Set(

    varLoading,

    false

);

Navigate('View Pending Approval-2')

Categories:
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on 16 Feb 2022 at 14:26:41
    Re: PowerApps Code Sporadically Not Executing

    Hi @galexander80 

     

    Can we simplify these steps?

     

    Set(
     varLoading,
     true
    );
    
    Patch(
     Approvals,
     LookUp(
     Approvals,
     And(
     'Approval Role' = "EOS",
     SSDID = Value([@SSDID].Text),
     'Workflow Step' = "Initiation",
     Status = 1
     )
     ),
     {
     'Approval Date': Now(),
     'Approval Status': "Approved"}
     
    );
    
    ClearCollect(ApprovalInfo,
     Filter(
     Approvals,
     'Workflow Step' = "Initiation",
     SSDID = Value([@SSDID].Text)
     )
    );
    
    If(
     Value(Label8.Text) = 0,
     Patch(
     'SSD List Master',
     LookUp(
     'SSD List Master',
     SSDID = Value([@SSDID].Text)
     ),
     {Status: "Approved"}
     )
    );
    
    Set(
     varLoading,
     false
    );
    
    Navigate('View Pending Approval-2')

     


    Thanks, Stalin
    Blog - Learn To Illuminate Blog
    YouTube - Learn To Illuminate Videos

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473