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.

16 REPLIES 16

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)

yvenegas
Regular Visitor

HI, The question is how can I save a default value if it is not selected but if it changes my value in the container that takes that value and the rest that and the rest that stays with the value shown.

 

please help me

 

yvenegas_0-1673476034928.png

 

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 (3,968)