I was having difficulty getting a form to update a SharePoint List when I use a ComboBox that point to another SharePoint List and am curious why the update value of the datacard needed to be so specific.
I have a list of companies (my_companies) with a lookup field to the best point of contact (‘Best POC’) in another list (my_contacts.)
When I use the default edit form ‘Best POC’ card, updates work:
- Form1.DataSource: my_companies
- Form1 Item: First(my_companies)
- POC_DataCard Update: POC_ComboBox.Selected
- POC_DataCard Default: ThisItem.'Best POC'
- POC_ComboBox Items: Choices([@my_companies].bestpoc0)
- POC_ComboBox DisplayFields: ["Value"]
- POC_ComboBox SearchFields: ["Value"]
- SubmitButton OnSelect: SubmitForm(Form1)
Once it’s working, I want to be able to show multiple fields when the user views a selection in the POC ComboBox, so I change the ComboBox to use the contacts list directly instead of using Choices:
- POC_DataCard Default: LookUp(my_contacts, ID=ThisItem.’Best POC'.Id)
- POC_ComboBox Items: my_contacts
- POC_ComboBox DisplayFields: ["Title"] - (will add other fields once it works)
- POC_ComboBox SearchFields ["Title"]
I have tried the following values for the POC_DataCard Update value (the first two fail to update the my_companies list):
- POC_ComboBox.Selected - same as original card
- LookUp(my_contacts, ID=POC_ComboBox.Selected.ID)
- {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:Text(POC_ComboBox.Selected.ID,"[$-en-US]0"),
Value: POC_ComboBox.Selected.Title
}
Option 3 works (thanks to this answer), and can be reduced to:
{
Id:POC_ComboBox.Selected.ID, - note lower case ‘d’, a capital ‘D’ will fail
Value: POC_ComboBox.Selected.Title
}
I am curious why options 1 and 2 fail… they seem like they would return the same (although expanded) record.