Skip to main content

Notifications

Community site session details

Community site session details

Session Id : GUwDb18bXANAoKOV4TjP43
Power Apps - Building Power Apps
Answered

combobox default selected items

Like (1) ShareShare
ReportReport
Posted on 2 Aug 2023 22:28:04 by 80

Hi, 

 

I'm just trying to make a data card here where it should store it's according value: 

Screenshot 2023-08-02 at 5.23.36 PM.png

 

The reason I'm doing this is I need to make a more user-friendly combobox where they can also see who's the manager of the cost center, not only their numbers. 

 

But I'm using 'Cost Center' value in my flow without the managers' names, so I would like to make it auto-selected based on ccValuewithManagerName, and just make 'Cost Center' data card invisible. 

 

But I'm getting errors here. Can someone help me out with this? thank you!

 

+) Both 'Cost Center' and 'ccValuewithManagerName' is the columns in sharepoint list with Choices data type. 

  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on 02 Aug 2023 at 22:33:08
    Re: combobox default selected items

    @pinball2 

    Based on what you described, I assume you are trying to set the value of a ComboBox (or other data card) based on another ComboBox's selected value in Power Apps Canvas App, using Power Fx.

    Specifically, you want to set the 'Cost Center' value based on the selected 'ccValuewithManagerName' value.

    If I understand correctly, you're trying to auto-fill the 'Cost Center' field whenever a manager is selected in the 'ccValuewithManagerName' ComboBox.

     

    Here's a possible solution. In the formula bar for the 'Cost Center' ComboBox's DefaultSelectedItems property, you can reference the 'ccValuewithManagerName' ComboBox's selected item.

     

    In Power Fx, you might write something like this:

    {Value: ccValuewithManagerName.Selected.Manager}


    This formula implies that the 'ccValuewithManagerName' ComboBox has a column called 'Manager' that corresponds to a value in the 'Cost Center' ComboBox.

    When a user selects an item in the 'ccValuewithManagerName' ComboBox, the 'Cost Center' ComboBox will automatically select the manager associated with that item.

     

    However, if you're getting a red squiggle error on "2011-", it seems like Power Apps is not recognizing this as a valid choice in your 'Cost Center' field. You may want to check if this value exists in your 'Cost Center' field. If it does not exist, then that would explain why you are seeing the error.

     

    In Power Fx, a common issue when dealing with strings and Choice fields in SharePoint is that the value you are trying to use is a string, but the Choice field expects a record.

     

    In Power Apps, SharePoint Choice columns are represented as a table, with each choice represented as a record with properties like Value, Id, etc. So when you are trying to set the value of a Choice field, you should be providing a record that matches the structure expected by the field, not just a string.

     

    For instance, if you are trying to set the value of your Choice field ('Cost Center' or 'ccValuewithManagerName') to "2011-", you need to use the correct record structure, something like this:

    {Id:1, Value:"2011-"}

    The Id you provide should match the Id of the choice in the SharePoint list.

    In case, if you want to look up the record based on the Value, you can use the LookUp function, like this:

    LookUp(Choices('Your SharePoint List'.'Cost Center'), Value = "2011-")

    Replace 'Your SharePoint List' with the actual name of your SharePoint list.

     

    If you continue to see an error, it's likely that "2011-" does not exist as a choice in your SharePoint column. You will need to verify the choices in your SharePoint column and ensure that the value you are trying to use does indeed exist there.

     

    See if it helps @pinball2 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 58

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 42 Super User 2025 Season 1

Overall leaderboard
Loading started
Loading complete