Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to set DefaultSelectedItems when Choice list contains Users

(0) ShareShare
ReportReport
Posted on by 714 Super User 2025 Season 1

I should be able to have figured this out on my own but I've spent far too much time now trying to figure this out on my own. Any search results found either are just different enough they don't apply or doing what is suggested doesn't resolve my challenge.

Oh well.
Here goes:

Simple datacard on a form that works. It just doesn't save/update this column correctly.

DC1.Default = ThisItem.Status (meaningless since the form resets and opens in FormMode.New anyway)

Dropdown_Status.Items = Choices([@'SPIFF - Approvals'].Approver) (this populates correctly and if the user was actually making a selection, I'd filter it. But this too is meaningless as we'll soon see.)

Dropdown_Status.DefaultSelectedItems = User() (This seems like it should work. When looking at the statement in the IDE, it shows returning a single record. Myself during unit testing of course)

Dropdown_Status.Default = NULL (Since I'm using DefaultSelectedItems, this seems unnecessary)

 

But when the form opens in New Mode, of course it ignores that I just realized. So now I think I understand what the actual problem is but not sure the best way to resolve.

 

Should I put the form in Edit mode on Reset? If I do, should I clear out default values which shouldn't be there?

 

Update: I tried changing to Edit mode which fails at present because there is no valid record to display/edit. So using the form in New mode seems like the right thing. 

Categories:
  • Verified answer
    DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: How to set DefaultSelectedItems when Choice list contains Users

    I figured it out. Man oh man.

     

    You have to do some funky stuff when you want to autoselect a user in a dropdown. It appears you can't simply use User().

     

    The solution was setting the Default on the datacard to this:

    If(
     Parent.Mode = FormMode.New,
     {
     Claims: Concatenate(
     "i:0#.f|membership|",
     User().Email// Person email
     ),
     Department: "",
     DisplayName: User().FullName,
     Email: User().Email,
     // Person email
    JobTitle: "",
     Picture: ""
     },
     ThisItem.Approver
    )
    

    I added the If statement because I realized as I was solving this that I will need to provide the ability to modify this record which means opening the form in Edit mode later.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard