Fixing DefaultSelectedItems in Power Apps Modern Combo Box control for Large Data Sources

Introduction

The Modern Combo Box control in Power Apps offers a cleaner user interface, improved accessibility, and smoother performance through virtualization. However, when working with large data sources, many developers encounter an unexpected limitation:

  • DefaultSelectedItems works correctly with the classic Combo Box

  • The modern Combo Box fails to select records beyond roughly 500–800 items

This behavior is common and directly related to how the modern control handles data.

The Problem: DefaultSelectedItems and Large Data Sources

When the modern Combo Box is connected to large data sources such as:

  • Office 365 Users

  • SharePoint lists

  • Dataverse tables

You may experience issues including:

  • Previously saved values not appearing in the Combo Box

  • Edit forms opening with empty fields

  • Records saving successfully but not displaying on screen load

The same configuration typically works without issues when using the classic Combo Box.

Why This Happens

The modern Combo Box uses virtualization to improve performance.

Key behavior:

  • Only the first 500–800 records are loaded into memory

  • DefaultSelectedItems is validated only against this in-memory buffer

As a result:

  • If the selected record exists within the first ~800 records, it is displayed correctly

  • If the selected record exists beyond that range, the control cannot resolve it and ignores the default selection

The Solution: Merge the Selected Record into the Items Collection

Because loading the full dataset is not practical, the solution is to ensure that the selected record is explicitly included in the data rendered by the Combo Box.

Once the selected record is part of the Items collection, the control can resolve it correctly regardless of its original position in the data source.

Step-by-Step Implementation

Step 1: Store the Selected Record

Set(
    varSelectedUser,
    LookUp(DataSource, ID = ThisRecordID)
);

Step 2: Merge the Selected Record into the Items Property

With(
    {
        wSelected: If(
            !IsBlank(varSelectedUser),
            Table(varSelectedUser),
            Blank()
        )
    },
    Ungroup(
        Table(
            { Data: Office365Users.SearchUserV2({ searchTerm: "" }) },
            { Data: wSelected }
        ),
        "Data"
    )
)

This approach:

  • Loads the live Office 365 Users dataset

  • Wraps the selected user into a table

  • Merges both datasets

  • Flattens the result into a structure the Combo Box can process

Step 3: Configure DefaultSelectedItems

DefaultSelectedItems: Table(varSelectedUser)

Results and Benefits

This pattern provides the following benefits:

  • Works with very large organizations (10,000+ users)

  • Default selections display correctly in edit forms

  • Prevents missing or disappearing values

  • Maintains search functionality

  • No noticeable performance impact

  • Compatible with Office 365, SharePoint, Dataverse, and SQL data sources

Final Notes

The modern Combo Box control improves performance through virtualization, but its limited in-memory record window can cause issues with default selections when using large datasets.

By merging the selected record into the dataset rendered by the control, you ensure consistent and reliable behavior for DefaultSelectedItems regardless of data size.