Hi,
I'm having an issue with a form in edit mode and I could use some help.
I have a sharepoint list with different records, let's call it CasesList. I have a canvas app connected to that sharepoint list. This app has a gallery from which I can select an item from that sharepoint list. Then, I have a form in edit mode, where I can edit the item selected. In that form, I have a couple datacards that appear as dropdowns, since they are lookup columns on my sharepoint list CasesList, allowing me to select a value from another list, let's call it UserList.
This is my Items property on the datacard: Choices([@CasesList].User)
This is my DefaultSelectedItems property on the datacard: ThisItem.User
The reason I have this DefaultSelectedItems property is because of two reasons:
- When I enter the edit form, I need to be able to visualize the current value on that record, besides allowing me to change it
- When I enter the edit form, if I don't make any changes in that field, I need the current data to stay the same.
The issue is the following:
- I select the item from the gallery and navigate to the edit form screen
- I see the current value for that record within the form,
- I don't want to only change the value for another value, but also be able to "unselect" it, so I can remove the value and save that field empty instead, in cases where I need to remove that value.
For some reason, the dropdown datacard (which isn't multi-select), does not allow to unselect the options, not allowing me to "clear" that field in order to save it empty.
From my CasesList in sharepoint I confirm the field does not require to contain information, does not enforce unique values and does not allow multiple selection.
I tried a pretty messy workaround, that didn't work:
If(DataCardValue.Selected.Value = ThisItem.User.Value, Set(changed, true)) --> To "fake" the unselect. If I open the dropdown and select the same value that is currently in the data, changes the variable "changed" to true. Then, on the defaultSelectedItems, I added:
If(!changed, ThisItem.User)
This wasn't enough, the dropdown would clear visually, but on the backend let's say, it kept the same value so when I submitted the form, it would still keep the same value instead of removing it.
Any ideas on how to fix it?
Thanks