web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / The Requested Operatio...
Power Apps
Answered

The Requested Operation is invalid when patching combobox value to text column in SharePoint

(0) ShareShare
ReportReport
Posted on by 103

I have a combobox and I want to patch the value to a SharePoint list onchange. I am getting an error "The Requested Operation is invalid" when trying to patch and I cannot for the life of me figure out why. What's odd, is that the patch function is working, but I can't have it shouting error messages to the user. I have tried refreshing the datasource, removing and adding it back, using variables, separating the patch function out into a different button and selecting it from the onchange property of the combobox, but nothing works. 

 

Here is the combobox code for  its properties:

items:

 

Split(ThisItem.Choice_Field_item,",")

 

defaultselecteditems:

 

If(!IsBlank(ThisItem.Answer) && ThisItem.Question_Type = "Choice",LookUp(Split(ThisItem.Choice_Field_item,","),ThisItem.Answer = Result),Blank()

onchange:

UpdateContext({var_choice: Text(Choice_Input.Selected.Result)});
UpdateIf(col_questions, ThisItem.QuestionID = QuestionID && ThisItem.Question_Type = "Choice", {Answer:Text(Choice_Input.Selected.Result)});

If(
 Choice_Input.Selected.Result = "Product" || Choice_Input.Selected.Result = "In-Kind" && !IsBlank(ThisItem.Child_Dependent),
 Collect(
 col_dependent,
 {QID: ThisItem.Child_Dependent}
 ),
 Not(Choice_Input.Selected.Result = "Product") || Not(Choice_Input.Selected.Result = "In-Kind"),
 RemoveIf(col_dependent, QID = ThisItem.Child_Dependent)
);

If(var_Existing_Answers = true && ThisItem.Question_Type = "Choice", Patch(Answers, LookUp(Answers, ID = Value(ThisItem.AnswerID)),{Answer:var_choice}));

 


Selecting multiple items is set to false and this combobox is inside a gallery. On the onchange property, I also am updating a record in the collection the gallery is tied to using this piece of code from the onchange property: 

 

UpdateIf(col_questions, ThisItem.QuestionID = QuestionID && ThisItem.Question_Type = "Choice", {Answer:Text(Choice_Input.Selected.Result)});

 

I have almost this exact same code for all other controls in the gallery and they all work fine, except for the combobox. 

 

Categories:
  • Verified answer
    Bhanes22 Profile Picture
    103 on at

    figured it out I hope at least unless suddenly tomorrow it breaks again -- This is what I changed to the patch to reflect the items in the defaultselected items property. O also I slightly changed my default selected items property.

    Default selected items property change:

    If(!IsBlank(ThisItem.Answer) && ThisItem.Question_Type = "Choice",Filter(Split(ThisItem.Choice_Field_item,","),ThisItem.Answer = Result))

    New  patch function on the onchange property

     

    ForAll(Filter(Split(ThisItem.Choice_Field_item,","),ThisItem.Answer = Result),
     If(var_Existing_Answers = true && ThisItem.Question_Type = "Choice", Patch(Answers, LookUp(Answers, ID = Value(ThisItem.AnswerID)),{Answer:
     ThisRecord.Result})));

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard