cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SPDevOne
Helper I
Helper I

How to Save Choice field value using UpdateIf/Patch functions

Hi,

 

I have one button on click of it I would like to save choice field value. I have tried both the UpdateIf and Patch functions but not working.

 

Code of UpdateIf:

UpdateIf(Leaves,ID=ThisItem.ID,{Status:"Approved"})

Error:

"The type Text is invalid for column 'Status'. Record expected. The function 'UpdateIf' has some invalid arguments."

 

Code of Patch:

Patch(Leaves,Defaults(Leaves),{Status:"Approved"})

Error:

"The type of this argument 'Status' does not match the expected type 'Record'. Found type 'Text'. The function 'Patch' has some invalid arguments."

 

Please guide me for save choice field value.

15 REPLIES 15

Hi FacundoGorla, 

It just worked like a charm , thanks for posting this . Its was a real help . 

 

Thanks ,

Aarthi

THANK YOU!!! Been searching for this answer for the past day. I plugged in your solution, updated for my specific data set, and BAM! it worked on the first go. 

 

WHY would MSFT make this so difficult to do? Not at all an intuitive code snippet, or one that could be figured out without some deep, wizard-level knowledge, so thank you very much for sharing!!  

 

 

Pegger
Helper I
Helper I

I am trying to apply this solution so that when a Radio button is selected, the value for the appropriate record is updated in SharePoint.  I am using a Patch statement within the OnSelect control, but I need some parts of the code within the Patch statement to refer to a dropdown value selection for filtering the correct SharePoint record AND the radio selected value the user selects.  See below code...

 

Patch(Country_Master,

First(Filter(Country_Master,Country='DropDown1'.Selected.Value)),

{Choice_Field:

{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

Id: IF('Radio'.Selected.Value="Always",0,IF('Radio'.Selected.Value="Never",1)),

Value: 'Radio'.Selected.Value}

})

 

Unfortunately, I get a patch argument error.  Appreciate any guidance on this.

KaupRene
New Member

For me this worked

 

Patch('List';ThisItem;
{Status:
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
Value:ListBox1.Selected.Value}})

Thanks, it worked, this solution is very difficult to come up with 

hoorakhsh
New Member

here is the best way to patch choice field:

LookUp(Choices([@M_req].MR_proiority),Value=Dropdown1.Selected.Value)

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,950)