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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ComboBox - DefaultSele...
Power Apps
Unanswered

ComboBox - DefaultSelectedItems - how to set to current user

(0) ShareShare
ReportReport
Posted on by 239

Hello,

I have a combo box in my app that is filtering data from a SP list called "TEMPO_Users". It is filtering the names of the managers from a column called "WorkloadManager".

I would like the app to automatically have the current manager's name (the current user) populated into the combo box when he/she loads the app. 

Currently, he/she needs to select from 2 choices as there are two different managers in the list at this time. 

The code that I have in the Items property currently is;

Filter(Distinct(TEMPO_Users,WorkloadManager),Result <> Blank())

Please see image: You will notice that I (Angele Lapointe) am the currently-signed in user. I would like this combo box to default to my name when I am logged in, and to Denis' name when he is logged in.

AuburnMist_0-1661804607277.png

 

Thank you! 

Angele 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @AuburnMist 

    How are you getting the current user name currently?

     

    If that is a Combobox (and not a Dropdown control), then your DefaultSelectedItems property (DSI) should be:

    {Result: <HoweverYouHaveTheCurrentUserNow>}

     

    If you have no current way to get the user name, then you can set the DSI formula to:

    {Result: User().FullName}

     

    I hope this is helpful for you.

  • AuburnMist Profile Picture
    239 on at

    Hi Randy,

    I thought for a moment that your proposal was indeed my solution, but, when I applied the same code to another combo box where I am not even in the list of manager names, my name appeared upon load. My name should only appear if I am in the list to begin with. Is this achievable? I believe the code must first look through the list of possible names, then auto-populate to my own name IF I am on the list. If not, it should remain blank and allow to make a selection. 

     

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @AuburnMist 

    Well, the DSI is completely dependent on the Items property.  So, what works for one would not necessarily work for the other!

    What is the Items property of your current combobox?  And, if it is for some reason a collection, how (what is the formula) is that collection populated?

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @AuburnMist 

    Oh, incidentally, you CAN set a DSI on a combobox with something that is not in the Items table.  This however will NOT make it selected (i.e. in the SelectedItems property).  

    So, in other words, if your name showed up, that would be a "ghost" as it is not in the Items, so it would not end up being a selected item. 

    Hope that makes sense!

  • Verified answer
    AuburnMist Profile Picture
    239 on at

    I found a code that provides the result I was looking for!  I added this in the DSI: 

    Filter(Distinct(TEMPO_Users,WorkloadManager),Result=User().FullName)

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @AuburnMist 

    Yep, but as mentioned in my response, you just need a record to match the Items property record.

    So the Formula:

    {Result: User().FullName}

    Would have done the trick to if your results from the Items match full names.  The filter just adds more data operations (i.e. less performance) to the app.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard