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.

14 REPLIES 14

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 

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,147)