Hi,
I have a form containing a combobox dropdown called DataCardValue16 that saves to a Sharepoint List called Computer Orders. The dropdown choices are from a lookup SharePoint list called Computer Types
SharePoint List - 'Computer Types':
In the App's OnStart property, I've added the following code.
ResetForm(SharePointForm1);
Clear(ComputerItems);
Set(varComputerTypeID, Value(Param("ComputerTypeID"))); //Save ComputerTypeID parameter to variable varComputerTypeID
The dropdown is a single selection. In the dropdown's Items property, I've left as is the following code.
Choices([@'Computer Orders'].Computer_x0020_Type)
In the dropdown's DefaultSelectedItems property, I've added the following code.
If(
SharePointForm1.Mode = FormMode.New,
{
ID: LookUp('Computer Types', ID = varComputerTypeID, ID),
Value: LookUp('Computer Types', ID = varComputerTypeID, Title)
},
Parent.Default
)
In the corresponding datacard's update property, I've left as is the following code.
DataCardValue16.Selected
When the form is loaded via the query string url, it populates the dropdown with the correct Computer Type.
When I click my Submit, it saves the record details except for populated Computer Type (which is a required field) to the Computer Orders list.
Any ideas on why it's not saving correctly?
Just a quick read, but you said the combobox is called "DataCardValue18" but in the update you seem to be referenceing "DataCardValue16".
Could that be the source of you problem?
Ah yes, definitely a typo on my part (re-edited post).
Unfortunately not the source of the error after double checking.
Hi @CoelDorsey ,
This is a little unusual due to the way the DefaultSelectedItems have been structured, but this may work in the Update
{
Title:DatCardValue16.Selected.Value
Id:DataCard16.Selected.ID
}
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @CoelDorsey ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @WarrenBelz,
I added the following code to the update field for DataCardValue16.
Unfortunately, it still won't save the Computer Type when the Computer Type dropdown is pre-populated.
However, it will save the Computer Type if the Computer Type dropdown selection has changed.
{
Title:DataCardValue16.Selected.Value,
Id: DataCardValue16.Selected.Id
}
Hi @CoelDorsey ,
You try this in the DefaultSelectedItems
If(
SharePointForm1.Mode = FormMode.New,
{
ID: LookUp('Computer Types', ID = varComputerTypeID, ID),
Value: LookUp('Computer Types', ID = varComputerTypeID, Title)
},
{
Value:ThisItem.Title
Id:ThisItem.Id
}
)
but Lookup columns are temperamental beasts at the best of times without putting conditional values in them. I have not used them for a long time. You might take a few minutes to watch this video from Shane Young @Shanescows on the subject.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @WarrenBelz ,
I tried your suggestion but unfortunately it throws an error message.
I do happen to have a couple other dropdowns on the same form that use Lookups from other lists and they all function correctly. But this is the only dropdown where via a query string url, the dropdown is pre-populated with a item and doesn't save the dropdown value back to the SharePoint list record.
Thanks @CoelDorsey ,
I have now done some testing here and as I mentioned, Lookup columns present unnecessary challenges, especially when some changes are made to some core functions, but I managed to get this working on a model. You will need less than 2000 items in your 'Computer Types' list as the relational LookUp is not Delegable.
With(
{wComp: 'Computer Types'},
{
Value: DataCardValue16.Selected.Value,
Id:
LookUp(
wComp,
First(Computer_x0020_Type).Value = DataCardValue16.Selected.Value
).Computer_x0020_Type.Id
}
)
It was a good exercise for me in confirming why I simply do not use them.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @CoelDorsey ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
User | Count |
---|---|
210 | |
94 | |
84 | |
49 | |
39 |
User | Count |
---|---|
265 | |
104 | |
104 | |
61 | |
59 |