cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fher
Frequent Visitor

Patch of SharePointList Item from PowerApps always creates new Entry instead of Updating existing

Hi there,

 

I am having trouble with "patching" existing records of a SharePoint List from Powerapps.

 

I simply have a button in my app and the OnSelect Property looks like

"Patch(TimeTracker;{User:User().FullName};{CheckedIn:true})".

 

An entry with the condition "{User:User().FullName}" exists but the app still creates a new entry all the time. Doesnt matter what I am trying.

 

Maybe someone of you got an idea why? Am I doing something wrong here?

 

Best Regards

Felix

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

If you are updating an item with Patch then the second parameter needs to be the record you want to update.

 

Example:

Patch(TimeTracker; First(Filter(TimeTracker; User = User().FullName)); {CheckedIn:true})



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Jeff_Thorpe
Super User
Super User

If you are updating an item with Patch then the second parameter needs to be the record you want to update.

 

Example:

Patch(TimeTracker; First(Filter(TimeTracker; User = User().FullName)); {CheckedIn:true})



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Hey,

 

thanks for the quick response.

 

I was thinking that "{User:Text(User().FullName)}" ,which is my second statement, determines which is the record I want to update. I chose this option rather than "First(Filter(TimeTracker; User = User().FullName))" because i thought its faster.

 

But i tried doing it with "First(Filter(TimeTracker; User = User().FullName))" and it works. I could swear i tried that before and nothing happened.. Dont know where my mistake was.

 

Thanks a lot, its working now 😃

SkiDK
Solution Sage
Solution Sage

Hi @fher 

 

Patch (
    TimeTracker,
    LookUp( TimeTracker, User = User().FullName),
    {
        CheckedIn: true
    }
)

In your condition, you actually push the value for a new entry. You have to search for that certain record you want to update. So first a LookUp that will contain the correct record, and then push your values to it to update.

 

EDIT: I see someone beat me to it

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,707)