endOfTunnel
endOfTunnel

Reputation: 13

How to reset a lookup value to blank and leave other values intact in a Power Apps form

In a simple canvas Power Apps form with several controls, I have a lookup field (data source is a SP List) whose selection I would like to be able to undo (revert to no selection whenever necessary). Currently, if I click the little "x" on the right hand side of the field, the selected value vanishes, but once I click the Save button, the selected value remains in the main SP List grid. I want to be able to reset this specific value from this one control (not values from the entire form). On the OnSelect property of a button, I have tried Reset(comboBoxLookupValueX) but that is not doing anything. Any ideas?

Upvotes: 0

Views: 1688

Answers (1)

mmikesy90
mmikesy90

Reputation: 981

If the SP field is not set to required, you could put this into the Button.OnSelect:

Patch(mySPList, myRecord, { myLookUpField: Blank() })

If it still doesn't work, I suggest you test with an open Monitor session in Studio and analyze the response coming from SharePoint, it can yield useful info.

Btw, if the current value in SP for the Lookup field is a given record, the Reset function will only restore this record as selection in your ComboBox as I guess it's set as the default value for the ComboBox via Default or DefaultSelectedItems.

Upvotes: 0

Related Questions