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 Platform Community / Forums / Power Apps / ComboBox default not w...
Power Apps
Unanswered

ComboBox default not working in Form Context Variable holding LookUp instead of LookUp as Item

(0) ShareShare
ReportReport
Posted on by 635

Hello

Please be so kind as to read my full post before responding.
In one PowerApp of mine I have a weird issue with the DefaultSelectedItems apparently not working.

In one EditScreen with an EditForm containing a ComboBox with Items,

Choices([@'Auslieferungen (WA)'].kk_warehouse_collector_id)

kk_warehouse_collector_id being a LookUp field, and DefaultSelectedItems

ThisItem.kk_warehouse_collector_id

and Form.DataSource

[@'Auslieferungen (WA)']


On AnotherScreen containing a Gallery with Items 

[@'Auslieferungen (WA)']

and an GoToDetails Button in the template with OnSelect

Navigate(EditScreen, None, {
 selectedDelivery: LookUp([@'Auslieferungen (WA)'], kk_warehouse_deliveryid=UebersichtGallery.Selected.kk_warehouse_deliveryid)
})


Now to the weird part:
If I set EditForm.Item to

selectedDelivery

then the ComboBox doesn't get properly initialized with default values from the selected Record and it only shows InputTextPlaceholder/NoSelectionText.
image.png
If I set EditForm.Item to

LookUp([@'Auslieferungen (WA)'], kk_warehouse_deliveryid=selectedDelivery.kk_warehouse_deliveryid)

and in essence repeat the LookUp I just did in the Navigate function, then suddenly the ComboBox default works.
image.png

 

  1. What is happening here?
  2. Why can't I directly use selectedDelivery, which as far as I understand gets set to the same thing in the context variable part of Navigate?

Last tested with:

App ID: 8200a3f3-30fd-44f9-b3b7-0c9e0f803c50
Session ID: 21a66c2e-a2f6-472c-bffc-a84600ce0745
PowerApps 3.19081.26


Thank you,
    Sa.
Categories:
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @SaWu , 

    Could you please share a bit more about the 'Auslieferungen (WA)' data source within your app? Is it a SP list?

     

    Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned.

     

    Please consider use a global variable to store selected item in your Gallery rather than use Context variable. Within the Gallery of your BrowseScreen, set the OnSelect property of the "GoToDetails" button to following formula:

     

    Set(CurrentSelectedItem, LookUp([@'Auslieferungen (WA)'], kk_warehouse_deliveryid = UebersichtGallery.Selected.kk_warehouse_deliveryid));
    Navigate(
     EditScreen, 
     ScreenTransition.None
    )

    Or

    Set(CurrentSelectedItem, ThisItem);
    Navigate(
     EditScreen, 
     ScreenTransition.None
    )

     

    Then set the Item property of the Edit form to following:

    CurrentSelectedItem

     

    In addition, I think it is not necessary to bind the Item property of the Edit form to a variable, instead, you could bind the Item property of the Edit form to the selected item in your Gallery directly.

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

     

  • SaWu Profile Picture
    635 on at

    Hello @v-xida-msft 

    Thank you for your reply.

    I am not using Sharepoint.
    My whole app is purely CDS/Dynamics.
    That is "Auslieferungen (WA)" is a CDS/Dynamics Table (and plural name) of a custom entity "Auslieferung (WA)" (kk_warehouse_delivery).
    This custom entity also contains a LookUp field "kk_warehouse_collector_id" to another custom entity (kk_warehouse_collector).
    The ComboBox is exactly for this LookUp field.

    I know that I can bind the Form directly to Gallery.Selected but this has it's own set of drawbacks, see also:
    https://powerapps.microsoft.com/en-us/blog/decouplingbrowsegalleryfromforms/
    https://blogs.msdn.microsoft.com/carlosfigueira/2017/10/04/decouplingbrowsegalleryfromforms/

    Also, please note that the screen transition of Navigate has been optional since several versions of PowerApps releases, see also
    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate
    image.png
    In my example I need to put in None for the optional Transition argument to "reach" the UpdateContextRecord argument.

    I will try to see if there is a difference with a global variable.

    Thanks,
        Sa.

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

    Hi @SaWu ,

    Have you taken a try with the global variable I mentioned above?

    Have you solved your problem?

     

    Actually, I think it is not necessary to set a variable to store the selected item within the Gallery. Instead, you could consider bind the Edit form within the selected item in your Gallery directly using the following formula:

    Gallery1.Selected

    Best regards,

  • SaWu Profile Picture
    635 on at

    Hello @v-xida-msft 

    I want to stress again that, as previously posted, I have a workaround (putting the LookUp into Form.Item).

    Still I have tried your propositions.
    I tried using Set and a global variable instead of UpdateContext and a context variable.
    image.pngimage.png
    Still, the ComboBoxes for the lookup fields don't populate.
    image.png

    I also tried using Gallery.Selected to see if the ComboBoxes populate, and they do.
    image.pngimage.png
    However, as already posted in my previous answer to you, I have other preconceptions, supported by PowerApps blog articles, that make me want to avoid using Gallery.Selected.
    One important point is that creating a new record, saving it, and still show the edit form for this new record allowing further changes, while never leaving the edit form screen, is impossible to do by using Gallery.Selected (as far as I know).
    But exactly this scenario is one of the most common use cases for our users.

    My guess, which you might want to forward to the backend team, would be that saving a record with lookup fields (as either global or context variables) somehow messes with the "links" behind those lookups, such that the ComboBox can't expand those lookups, for example to look for SearchFields or DisplayFields, resulting in the default values of the ComboBox not being populated by the "truncated"/saved record with lookup fields.
    Obviously, putting the LookUp or Gallery.Selected into Form.Item avoids this issue as the "original" record with the "full" lookup fields is there.

    Thank you,
        Sa.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard