web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Dropdown default

(0) ShareShare
ReportReport
Posted on by 543

My datasources are two sharepoint lists: Customers and Orders. Orders are linked to Customers (lookup column).

 

I have one screen where the user can select a customer from a gallery. In this screen the user can click "Details" to navigate to the orders screen.

 

The orders screen lists the orders (in a gallery) for the selected customer and a form details the orders when the user makes a selection in this gallery. The user can then add/edit/delete orders from this screen. Edit and delete works great.

 

The issue I'm having is when the user wants to add an item (NewForm() is called and all fields are reset) - the Customer dropdown should of course have the default value of the previously selected customer (in the previous screen).

 

I've unlocked the Customer lookup datacard and tried to override the default value by doing a lookup to the Customer list, but the dropdown is empty.

 

What are the steps necessary to make this work? Is there some syntax or steps that I've overlooked?

Categories:
  • Delid4ve Profile Picture
    795 on at

    firstly your going to need to store the last value of the dropdown in a variable using the set function, this would probably be best in the Onchange property of the dropdown.

    Secondly In the dropdown default i think your going to need to use an if statement to check what mode the form is in.

    If its in edit then use the lookup for the current record, if in new then use the variable.

     

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @JohnP,

     

    The question here is, what is the Customer field data type under the Orders list, is it a Person or group type?

    If that is, and the Customer list also has a Customer Field (Should also be the Person or Group type), then we could configure the default property of the Corresponding Dropdown control with the code below:

    If(Editform1.mode=1, Gallery1.Selected.Customer, Parent.Default)

    Doing this should meet your requirements.

     

    Regards,

    Michael

     

  • JohnP Profile Picture
    543 on at

    @Delid4ve wrote:

    firstly your going to need to store the last value of the dropdown in a variable using the set function, this would probably be best in the Onchange property of the dropdown.

    Secondly In the dropdown default i think your going to need to use an if statement to check what mode the form is in.

    If its in edit then use the lookup for the current record, if in new then use the variable.

     


    @Delid4veWhat if there are no orders for the selected customer? Then there is no last value to save...

  • JohnP Profile Picture
    543 on at

    @v-micsh-msft wrote:

    Hi @JohnP,

     

    The question here is, what is the Customer field data type under the Orders list, is it a Person or group type?

    If that is, and the Customer list also has a Customer Field (Should also be the Person or Group type), then we could configure the default property of the Corresponding Dropdown control with the code below:

    If(Editform1.mode=1, Gallery1.Selected.Customer, Parent.Default)

    Doing this should meet your requirements.

     

    Regards,

    Michael

     


    @v-micsh-msftCurrently in the Orders list I have one field called CustomerLookup which is a Lookup field to the Customer list. I have tried your suggestion with the following syntax (default value of dropdown):

     

    If(OrderForm.Mode=New, CustomerGallery.Selected, Parent.Default)

     

    Works in edit mode, but not when I try to add a new item (dropdown is blank). The problem is, I think, that the selected property is not compatible with the lookup column. But PowerApps does not report any error.

  • Verified answer
    JohnP Profile Picture
    543 on at

    I figured this out from doing some research.... the default value of the dropdown should be like this when you're dealing with SharePoint lookup fields:

     

    {'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id : BrowseGallery1.Selected.ID,
    Value: BrowseGallery.Selected.Title}

     

    No need to check for edit or new mode either 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard