cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
petergriac
Level: Powered On

Update item in Sharepoint List

Hi,

I use PowerApps custom form to sharepoint list. I have created the item in the list and now I would like to update the status of the Item.

I have created button called "Accepted" and whe user pressed the button, status changes to "Accepted". I put Patch function on Onselect property, but the item is not updated. Does anyone know how to user Patch function to update item in sharepoint list?

My Patch looks following:

 

Patch(

       SourceList,
       {ID: DataCardValue28},    // ID of the list

      {

       Status:"Accepted"

      } )

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Update item in Sharepoint List

@eka24 

If you are proposing another idea I think some changes should be made:

 

Patch(
    SourceList,
    LookUp(SourceList, ID = Value(DataCardValue28.Text),
    {Status: "Accepted"}
)

 

1.  LOOKUP should be used in the place of FIRST + FILTER.  LOOKUP is faster because it finds the first result and then stops to return it.  FIRST + FILTER will retrieve the entire dataset and then get the first result.  This is less efficient especially with large datasets.

 

2.  DataCardValue28 must be wrapped in a VALUE function to convert to a Number.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Update item in Sharepoint List

@petergriac 

Your 2nd argument {ID: DataCardValue28} is not the correct way to reference the record.  To do this you should use the LOOKUP function or simply use ThisItem if the current record showing in the custom form is what you wanted to edit.

 

 

Patch(
    SourceList,
    ThisItem,
    {
        Status: "Accepted"
    }
)

 

 

Note: my Solution assumes the Accepted button is placed inside the form.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

eka24
Level 10

Re: Update item in Sharepoint List

Kindly use this:
Patch( SourceList, First( Filter( SourceList, ID = DataCardValue28.Text) ), { Status: “Accepted" } )
Super User
Super User

Re: Update item in Sharepoint List

@eka24 

If you are proposing another idea I think some changes should be made:

 

Patch(
    SourceList,
    LookUp(SourceList, ID = Value(DataCardValue28.Text),
    {Status: "Accepted"}
)

 

1.  LOOKUP should be used in the place of FIRST + FILTER.  LOOKUP is faster because it finds the first result and then stops to return it.  FIRST + FILTER will retrieve the entire dataset and then get the first result.  This is less efficient especially with large datasets.

 

2.  DataCardValue28 must be wrapped in a VALUE function to convert to a Number.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

View solution in original post

eka24
Level 10

Re: Update item in Sharepoint List

@mdevaney
Thanks for the correction. I didn't see you have already answered that question. I delayed online.
Super User
Super User

Re: Update item in Sharepoint List

@eka24 

Its not a problem.  Sorry if I sounded rude, I did not mean to be.  Many times users are typing at the same time so it happens 😄

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

petergriac
Level: Powered On

Re: Update item in Sharepoint List

Hi @mdevaney,
Wouldn't be Lookup function problem for datasets with more than 500 records?

 

ThisItem solution throws an error for me.

 

Thanks anyway

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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