cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Impactful Individual
Impactful Individual

Patch function has stopped working properly

My canvas app has a registration form with a SharePoint list (LaserRegistration) as a data source. 

On the OnSelect of the submit button there is this:

UpdateContext({LastLaser: Last(LaserRegistration)})

Then the OnSuccess of the form there is a patch:

Patch(
LaserRegistration,
Last(LaserRegistration),
{
Title: "LAS - " & LastLaser.ID,
'Laser ID': "LAS - " & LastLaser.ID,
LaserStatus: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "NEW"
}
}
);

This has been working fine for over a year now. I logged into the app in the studio around the 20th April and since then, the Title and Laser ID have stopped patching back with LastLaser.ID. 

I can see the patch is working because LaserStatus updates. The context variable LastLaser.ID is displaying correctly after submit.

 

I'm on PowerApps release 3.21043.23. I've tried changing to an earlier authoring version and a version of the app pre-20th April but the issue remains on testing. I've not changed anything in app otherwise. Is there anything else I could try?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@calvares 

You are using a Last function in your formula...this is not delegable.  Once you hit the record limit, from that point forward you will only get the last record of 2000 records.

 

Consider the following changes to your formula.

With({_last: First(Sort(LaserRegistration, ID, Descending))},
    UpdateIf(
        LaserRegistration,
        ID=_last.ID,
        {
          Title: "LAS - " & Text(_last.ID),
          'Laser ID': "LAS - " & Text(_last.ID),
          LaserStatus: {Value: "NEW"}
        }
    )
);
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
Pstork1
Dual Super User
Dual Super User

Check your Office 365 admin center > Services Health.  Power Apps is currently experiencing an outage.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
RandyHayes
Super User
Super User

@calvares 

Unless you are dealing with the outage right now, my other question would be, how many records do you now have in your list and what is your record limit set to in your advanced settings?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
calvares
Impactful Individual
Impactful Individual

The issue started at 1020 items and the record limit is 2000.

I didn't think that this limit affected data submitted back as well as queries?

RandyHayes
Super User
Super User

@calvares 

You are using a Last function in your formula...this is not delegable.  Once you hit the record limit, from that point forward you will only get the last record of 2000 records.

 

Consider the following changes to your formula.

With({_last: First(Sort(LaserRegistration, ID, Descending))},
    UpdateIf(
        LaserRegistration,
        ID=_last.ID,
        {
          Title: "LAS - " & Text(_last.ID),
          'Laser ID': "LAS - " & Text(_last.ID),
          LaserStatus: {Value: "NEW"}
        }
    )
);
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
calvares
Impactful Individual
Impactful Individual

I see, it's the Last function. I'll try this thanks.

 

So can it start failing well before it reaches 2000 records as it has here?

RandyHayes
Super User
Super User

@calvares 

The fact that you have an issue before hitting the limit is a bit unusual.  Not sure what the implication there is.

But, the new formula will sort the list in reverse order (which is delegable) and then take the First record in that result list.  From there the rest of the formula will do its thing.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
calvares
Impactful Individual
Impactful Individual

Thanks @RandyHayes your formula has resolved the issue.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,145)