cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Continued Contributor
Continued Contributor

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.
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 III
Dual Super User III

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.
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
Continued Contributor
Continued Contributor

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

calvares
Continued Contributor
Continued Contributor

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.
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
Continued Contributor
Continued Contributor

Thanks @RandyHayes your formula has resolved the issue.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,445)