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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set default selected i...
Power Apps
Unanswered

Set default selected item based on current user

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I have SharePoint list called Employees and it contain below field;( these field are single line  text and import from datavers using power automate. )

  1. Full name
  2. Email
  3. Division
  4. Operating Unit
  5. Approver name
  6. Approver Email

In canvas app, there are two drop down list called, opUnit(dropdown), Approver(dropdown)

Each dropdown list

opUnit ‘Items’ →District(‘Employees’, ‘Operation Unit’

Approver ‘items’ →District(‘Employees’, ‘Approver Name’

 

And I want to set their default selected item based on current user. 
Ex: if current user equal to Full name, then it’s related values populate in drop down lists.

 

I tried someway but it didn’t worked properly. Hope your support.

Categories:
I have the same question (0)
  • MVP-Phipps Profile Picture
    3,508 Super User 2024 Season 1 on at
    Re: Set default selected item based on current user

    You can use User().FullName or User().Email to get the logged in user.

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at
    Re: Set default selected item based on current user

    Hi,

    If you have a drop down then you can use below formula in Default property of Operation Unit
    LookUp(Employees, Lower(Email) = Lower(User().Email), 'Operating Unit')

    I would suggest you to go for email

  • ShriniA Profile Picture
    on at
    Re: Set default selected item based on current user

    @NandiniBhagya20 

    I got error in this formula.

    I used LookUp(Employees, Lower(emailaddress) = Lower(User().Email),’Operating Unit’)

     

    This emailaddress is column name of Employees table Email.

  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Set default selected item based on current user

    Hi @ShriniA,

    Do you want to populate the Combo Box with corresponding user if the current user has the same full name with it exists in the Full Name column?

     

    The DefaultSelectedItems property expect table value, so you should set it as below:

    Filter('Employees',User().FullName='Full Name').'Operation Unit'
    Filter('Employees',User().FullName='Full Name').'Approver Name'
  • ShriniA Profile Picture
    on at
    Re: Set default selected item based on current user

    @v-qiaqi-msft ,

    Your query is worked but it doesn’t appear in dropdown field. I have no idea why it’s not appear in dropdown field.I checked it and get correct value. 

  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Set default selected item based on current user

    Hi @ShriniA,

    Could you please provide some screenshots to describe your scenario?

    Where do you have theses Combo Boxes and how you set the Item property of them?

     

    Please do provide some detailed screenshots about controls or anything else makes sense.

  • ShriniA Profile Picture
    on at
    Re: Set default selected item based on current user

    Here is the screenshot. 

    36EC4918-95E0-4EDA-898A-87B35652CB59.jpeg

    items →District(‘Employees’, ‘Operation Unit’)
    Dropdown list have correct items when apps play.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Set default selected item based on current user

    Hi @ShriniA,

    Okay, so it is a canvas app for Teams, right?

    You mean the options display correct, however it displays nothing within the Combo Box, right?

     

    Try to select the edit icon on the right pane of the fields, select the Result field name for the Combo Box.

    vqiaqimsft_0-1662539103596.png

    Then you should modify your formula as below:

    Filter(Distinct(Employees,‘Operation Unit’),Result=LookUp('KIT2.0_HR Data',Lower(currentuser)='Emailxxxx').‘Operation Unit’)

    Modify your Filter() function as LookUp() function but keep the content within.

     

    The key to this issue is that you set the Items property with a Result column table returned by Distinct() function, so you need to filter within the Result table rather than your data source.

     

     

  • ShriniA Profile Picture
    on at
    Re: Set default selected item based on current user

    @v-qiaqi-msft 

    Thank you. It works perfectly.

  • ShriniA Profile Picture
    on at
    Re: Set default selected item based on current user

    I need help below scenario.

    I get Employees data from dataverse by using power automate. Approver Name is not a display name in office 365 account. It’s just last name and first name. But I have Approver Email address which is match to office 365 account. My question is, how to get user display name by Approver email?

     

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 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard