Hello,
I have a Power App I built for tracking certain tasks within my company. The main entry/edit form utilizes modern Tab Lists and Modern Combo boxes as part of a modern form. Depending on the tab selected, different combo boxes are visible, some of which are required. I have the combo boxes set to use entries from a different SharePoint list and use the DefaultSelectedItems function using the value {Title:ThisItem.ColumnName'}. The Update formula are set to cboxValue.Selected.ColumnName. The problem I am running into is I have a "Submit" button that uses an if statement OnSelect:
If(Form1.Valid, SubmitForm(Form1),Notify("Required field(s) empty. Please review form to ensure all *required fields have data.",NotificationType.Error))
If the user does not click and view every tab, the Valid function does not recognize the form as valid and triggers the error notification. If you click through all the tabs allowing the combo boxes to become visible and appear to load the value, then it submits correctly. Any ideas?
@sk00lie884 explanation:
Typically, we create a Single Line Text Column in SharePoint, and then insert that Single Line Text Column into an EditForm control. We then remove the Text Input control, and replace it with a different control (in your scenario, a Combo Box control). We also set the Update property to point at the selected value from that Combo Box.
However, if we add either of the following into the DefaultSelectedItems property, we will see the following error:
The ComboBox is expecting a Table. As a workaround, we can force a Value into the DefaultSelectedItems property using the { } operator to "display" a value into that ComboBox.
{Value: Parent.Default}
With SharePoint (does not apply to Dataverse), this is perfectly valid because we are only interested in ensuring that the correct value is displayed. We also know if the user selects a different value in that ComboBox, the ComboBox will accept the selected item as a record and this selection will successfully save to SharePoint.
However, this approach will break the Unsaved and Valid property of the EditForm. These properties will return true if the Update and the Default property of the DataCards share the same result (a Record and a Value are not the same).
To accommodate for this, we can ensure a record is passed into the ComboBox by using the LookUp function. This function is useful because it can also return an entire record, rather than a specific column value of a record.
Further reading on Records vs Values:
https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-tables
Thanks! This appears to have fixed my issue! These forums have been incredibly helpful for me. I went from a never using Power Apps and Power Automate to having a series of Apps built and running 🙂
@sk00lie884 - consider replacing the DefaultSelectedItems property with:
LookUp(
ListName,
ColumnName = Parent.Default
)
The combo box item is either a another SharePoint list name or a filtered SharePoint list name based on the value selected for a related combo box:
@sk00lie884 - the likely cause is because although the " {} " operator will populate the DefaultSelectedItems property with a Value, the Valid property of each DataCard property is expecting a Record.
Could you provide an example of the formula you have in the Items property for one of those ComboBoxes?
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional