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 : TOvE91klxuXrhbkRyzBG5Z
Power Apps - Building Power Apps
Answered

Show values in dropdown based on logged in user

Like (0) ShareShare
ReportReport
Posted on 14 Aug 2023 16:37:35 by 519

Hello,

I have an app whereby I have a Division and Department and Cost Centre dropdown fields.  The idea is for the system to populate the Division and Department automatically based on the current logged in user.  There is also a cost centre dropdown field with a cost centre value for each user, which should populate based on that logged in user also.  The challenge is, some users are tied to multiple cost centres so whereas the Division and Department are singular and will remain the same, how can the system provide the logged in users with all the cost centres assigned to them, so based on what they want to enter, they can select from the four or five cost centres, or for those who only have one assigned to them, that one alone will show.  Any guidance on how to achieve this appreciated.  

Categories:
  • Verified answer
    joshieboy Profile Picture
    519 on 16 Aug 2023 at 19:36:03
    Re: Show values in dropdown based on logged in user

    I think I figured out the issue.  Thanks @v-qiaqi-msft for the formula above.  I needed to replace email with DisplayName and also created a variable on AppStart to set Set(varUser,User()); - so there were some slight changes to your formula but it works well now.  The updated formula is:  ForAll(Filter('Test Div Dept Cost Centre',Employee.DisplayName=varUser.FullName).'CCentre Dropdown', 'CCentre Dropdown'.Value) and they were applied and changed accordingly for the Division and Department fields.  Works like a charm now.  Thanks again @v-qiaqi-msft  for that formula and also thanks to @Amik for the timely feedback, initial troubleshooting and assistance with this.  Will mark as solved.

  • joshieboy Profile Picture
    519 on 16 Aug 2023 at 15:24:02
    Re: Show values in dropdown based on logged in user

    I cannot seem to get this formula to work.  My user field in the SharePoint list is called "Employee" so I used Employee.Email=User().Email).

     

    Here is my completed formula but the dropdown shows no values:

    ForAll(Filter('Test Div Dept Cost Centre',Employee.Email=User().Email).'CCentre Dropdown', 'CCentre Dropdown'.Value)

     

    The field in SharePoint is also a dropdown list.  Should this be so or is something else missing?

  • joshieboy Profile Picture
    519 on 16 Aug 2023 at 04:10:44
    Re: Show values in dropdown based on logged in user

    Hello,

    Sorry for the delayed feedback.

    I have one SharePoint list called UserData and text fields for Division, Department and Cost Centre.  However, in the powerapp, I created dropdown fields and am looking at creating the relationship between each field by updating the items property.  I am not sure if this is the best approach, nor if the above formula will work with the option I am using, or if I need to have dropdown fields in SharePoint to tie to the dropdowns in Powerapps.  Any further guidance appreciated.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 15 Aug 2023 at 07:15:33
    Re: Show values in dropdown based on logged in user

    Hi @joshieboy,

    Here is a simple demo based on the following conditions:

    1). Cost Centre is a single Choice type in your SP list

    2). You have alread had a table with relationship between Cost Centre and Division and Department

    3). There is a column saving users, here I name it with User

     

    Set the Items property of the Cost Centre dropdown:

    ForAll(Filter(list,User.Email=User().Email).'Cost Centre','Cost Centre'.Value)

    So do Division and Department dropdown control, replace 'Cost Centre' with Division and Department.

     

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on 14 Aug 2023 at 21:48:42
    Re: Show values in dropdown based on logged in user

    Hi @joshieboy - unfortunately not. I am still not clear on the last two questions. I will rephrase:

     

    2. How is the app supposed to know which Division, Department and Cost Centre/s are associated to which users? Is there a mapping table you're using? 

     

    3. By field type, I meant what are the data types in your SharePoint list for these fields. Are they Single Line Text, Choice etc. ?

  • joshieboy Profile Picture
    519 on 14 Aug 2023 at 17:46:19
    Re: Show values in dropdown based on logged in user

    Hello @Amik 

    The data source is a SharePoint list and each of the fields are dropdowns.  Cost Centre cannot be multiselect as users have to enter individual budget records for a single cost centre, but some users have multiple centres assigned to them, so whereas most should auto populate with the individual cost centre based on your logged in name, the ones with multiple should be able to choose any one from the multiple assigned to them, then complete the other fields and submit.  Hope this clears it up

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on 14 Aug 2023 at 17:03:39
    Re: Show values in dropdown based on logged in user

    Hi @joshieboy -

     

    1. What is your data source?
    2. I am assuming you have a separate table which maps each Division, Department and Cost Centre associated to each user?
    3. What are field types for Division, Department and Cost Centre? I assume Cost Centre is multi-select field?

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2