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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to set DefaultSele...
Power Apps
Answered

How to set DefaultSelectedItems when Choice list contains Users

(0) ShareShare
ReportReport
Posted on by 716 Moderator

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:
I have the same question (0)
  • Verified answer
    DCHammer Profile Picture
    716 Moderator on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 248 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 209 Super User 2026 Season 1

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 195

Last 30 days Overall leaderboard