Hi Community
I was following this guide on how to set default values for table lookup fields from SharePoint: Defining default values for complex SharePoint types in forms | Microsoft Power Apps (this post here Solved: How to set a pre-populated default value of a Drop... - Power Platform Community (microsoft.com) proposes similar code).
My code for the Default property looks like:
LookUp(Choices(Expenses.Status);Id = 1)
Unfortunately, the dropdown stays empty when opening this edit form... Is there something special, I should pay attention to?
Thanks
Hi community
After struggling quite a few times, finally, the issue got found. It's driving me crazy, but if you are working with Dropdown-fields, you must go with the "DefaultSelectedItems" property and not using the (also existing) "Default" property...
All the magic suddenly works, once taking the right property...
Have a nice evening
Hi @mdevaney and @Anonymous
Thanks for your answers. I was testing all of your proposals and some others too. I'm still struggling to get a value entered at all into this SharePoint LookUp Columns or better said the dropdown representing this lookup column.
Maybe some additional information: I'm having an EditForm connected to a SharePoint List with DataCards connected to columns of this SharePoint List. When leaving the Dropdown as it's created by Power Apps, I can easily choose an entry of the Status List (which is source of the Lookup Column). But I can't set one of these entries in the Status List as a default value.
Here some data:
SharePoint List "Expenses" has multiple columns. One of these columns is a lookup column to the SharePoint List "Status", it is looking up the Title Column of "Status".
Now, when adding an entry to the "Expense" list, the dropdown representing the lookup Column for "Status" should automatically choose the "Title"-Value of the "Status"-List entry with value 1 in the ID-Column.
Is this feasible?
Thanks
@Schwerzmann
Setting the Default value for a LookUp column can be accomplished like this.
{
Id: 1,
Value: LookUp(Expenses, Id=1, Status)
}
Do not make a lookup to a choices column. Change status to a text column instead. Choices columns just make things complicated here.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Hello @Schwerzmann ,
I think choices always uses Value so you need to use something like :
LookUp(Choices(Expenses.Status),Value = 1)
Don't forget the comma instead of semi comma
Reagrds,
Akram
------------------------------------------------------------------------------
If this helped you, please consider giving it kudos and accept it as a solution. Thanks
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional