1

Having trouble getting a seemingly simple patch command to work. I have a SharePoint list (myList) and want to update the title for the specified record when clicking a button (OnSelect).

PowerApps is giving me errors for ID_Datacard; invalid name. Tried a global variable, type does not match. The only thing that does work is manually entering a number like 1. I can get the ID for the record and display it in a label without problems, I just can't get patch to accept it.

Patch('myList', {ID: ID_Datacard.Default}, {Title: myTitle})

1

I suspect ID_Datacard.Default is not a number, hence a type mismatch error. Try converting ID_Datacard.Default to number using Value function:

Patch('myList', {ID: Value(ID_Datacard.Default)}, {Title: myTitle})

I've just tried 3 different methods of Patching and all of them worked just fine:

Patch(ListA, currentItem, {Title:'myTitle'})

or

Patch(ListA, {ID: currentItem.ID}, {Title:"New Title!"})

or

Patch(ListA, {ID: Value("2")}, {Title:"New Title!"})

You can also output ID_Datacard.Default to some label for debugging purposes to see if it actually contains a valid ID.

  • Those are good examples. Strange thing is it was working fine yesterday. It appears now my whole form is just flaking out, acting very weird in IE and Chrome, yet works fine in PowerApps preview. Any chance these files can get corrupted? – BDC604 Jun 1 '18 at 2:34
  • 1
    Way more flashes than normal postback, and now my combo box is flying off to the opposite side of the form, this is crazy. I think its posessed. – BDC604 Jun 1 '18 at 2:46
  • 1
    I had to go back quite a number of versions to flush out the weird behavior I was picking up with this form. Once I found a stable version your suggestions were very helpful in properly identifying the ID and patching without error. Thank you. – BDC604 Jun 1 '18 at 6:34
0

If you want to patch the record by using a parameter as the ID in the patch, then reference it like this:

Patch(ListA, {ID: Value(Param("MyParamaterName"))}, Title:"New Title!"})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.