
Announcements
Hi,
I need some help with my Power App. It is integrated with a SharePoint document library. I brought in a 2nd list as a datasource to look up to based on other selected values in the app. For instance, Approver 1 populates based on the Vendor chosen. User chooses Vendor, Approver 1 has a lookup to a Vendor List that stores metadata about that vendor, such as Approvers, Payment Method, etc.
Datacards:
Vendor Name (DataCardValue2.Selected.Label) - Combo Box; Items - Datasource-SP Site "Invoice" Doc library site column; Managed Metadata type field in SharePoint
Approver 1 (DataCardValue8.Selected) - Combo Box; Items - Datasource - SP List "Vendor" site column (also tried using the doc library site column); Person or Group type field in SharePoint.
Here are my ComboBox fields:
Items - Vendor List
DefaultSelectedItems - LookUp(Vendor,'Vendor Name'=DataCardValue2.Selected.Label,'Approver 1')
Update: DataCardValue8.Selected
Default: ThisItem.'Approver #1'
The lookup works perfectly. It pulls the Approver's name from the Vendor lists and populates it on the form which I can save successfully to the SharePoint doc library.
The issue is, if I have to change the approver on the form, not use the default, and save it, it saves to the library approver tag but when I reopen the form to edit again, the selecteddefault from the SharePoint list resets and I lose the previous that I manually selected.
I have tried doing an IF statement, when form is new v edit. This didn't work because it appears that SharePoint Power Apps custom forms always open in edit mode.
I have changed the datasource for the combo box from the library to the list.
I added a defualt value.
PLEASE HELP! I have watched hours of YouTube videos and read many different blogs trying each and every option but nothing is working. Thanks.
Hi @SunnyDVDB1 ,
Yes you need an If() statement of some sort as the control is doing exactly what you have asked it to do. The Default value is a waste of time as it does nothing on a Combo Box. If you only want the Approver when the Form is in New Mode, you can do this
If(
YourFormName.Mode = FormMode.New,
LookUp(
Vendor,
'Vendor Name' = DataCardValue2.Selected.Label
).'Approver 1',
ThisItem.'Approver #1'
)
If you want the lookup if there is nothing stored in your data field
Coalesce(
ThisItem.'Approver #1',
LookUp(
Vendor,
'Vendor Name' = DataCardValue2.Selected.Label
).'Approver 1'
)
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.
MVP (Business Applications) Visit my blog Practical Power Apps