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

Update a gallery item using a button

I am creating a leave request form. The manager will select a request from the gallery (similar to the Leave Request template) and select either approve or decline buttons.  I am getting an error when using Patch to set the approve button.  The approve button will change the data in the ApprovalUpdate field on the SP list (a choice field). 

 

What I current have in the OnSelect for the button: Patch(RequestTimeList, LookUp(RequestTimeList, ID=ThisItem.ID), {ApprovalUpdate: "Approved"});Refresh(RequestTimeList)

 

Getting an invalid argument type error.

leave-request-error.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Update a gallery item using a button

The choice field is expecting a record, so try this:

 

Patch(RequestTimeList, LookUp(RequestTimeList, ID=ThisItem.ID), {ApprovalUpdate: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value:"Approved"}});Refresh(RequestTimeList)



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

2 REPLIES 2
Super User
Super User

Re: Update a gallery item using a button

The choice field is expecting a record, so try this:

 

Patch(RequestTimeList, LookUp(RequestTimeList, ID=ThisItem.ID), {ApprovalUpdate: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value:"Approved"}});Refresh(RequestTimeList)



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

RobertC71
Level: Powered On

Re: Update a gallery item using a button

Thank you, that worked like a charm. The only thing I changed was that it didn't like the ID=ThisItem.ID, change it to ID=Gallery2.Selected.ID.  Thanks again.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,536)