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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show values in dropdow...
Power Apps
Answered

Show values in dropdown based on logged in user

(0) ShareShare
ReportReport
Posted on 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:
I have the same question (0)
  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    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

  • joshieboy Profile Picture
    519 on at

    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,687 Super User 2024 Season 1 on at

    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. ?

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    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.

     

  • joshieboy Profile Picture
    519 on at

    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.

  • joshieboy Profile Picture
    519 on at

    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?

  • Verified answer
    joshieboy Profile Picture
    519 on at

    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.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 993

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 545

Last 30 days Overall leaderboard