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.

Report
All responses (
Answers (