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 / Dynamic forms/gallery ...
Power Apps
Unanswered

Dynamic forms/gallery filtering

(0) ShareShare
ReportReport
Posted on by 321

Hi, 

 

So I am trying to work more dynamically and here is what I am trying to...


I have am Admin SharePoint list of all my team members, in that I have the following columns...

 

User Name: Single line of text

Email address: Single line of text

Personal ID: Single line of text

Business Area: Choice

 

I have a separate SharePoint list which stores (via a form in the App) details of submitted commissions to my team, this form collects data for all the Business Areas in my team.

 

I have a form for admins only (members of my team), who can view the submitted form an edit if needed. What I want to do is populate the form to only show the datacards in the form which are relevant to the logged in users specific Business Area (by looking up the Admin SharePoint list), and saying OK...this logged in user is attached to this Business Area, only show them X, Y, Z datacards.

 

Basically so I can specify which Business Area sees which datacards in the form. 

 

I am looking for the best way to achieve this, at the moment I just have a label on the App which looks up the SharePoint list against the Personal ID of logged in user, then displays in the text the Business Area of that person, then in the datacards on the form I set visible based on the text in the label. 

 

Just thinking there must be a batter, more dynamic way. 

 

Thanks

J

Categories:
I have the same question (0)
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    App.OnStart:

    Set(varUser,User());

    Set(varCurrentUserBusinessArea,LookUp(AdminList,Email = varUser.Email).BusinessArea);

     

    Above code will store current user's business area in the varCurrentUserBusinessArea variable.

    Then on individual data card's visible property write this:

     

    varCurrentUserBusinessArea = "ABC" || varCurrentUserBusinessArea = "XYZ"

     

    Above code will make a datacard visible for user who is either from ABC business area or XYZ business area.

    You get the idea. Do this for the individual data cards based on your business requirement

  • JimboSey Profile Picture
    321 on at

    Brilliant, works great. 

    Can I asked another question in relation....so the above scenario was for the admin side.

     

    What I want to do from the end user perspective is populate the fields in the form they see from what button they selected on the home screen.

     

    So lets say 'Button 1' and 'Button 2'

     

    The form has lets day 10 datacards, I want the form to only show specific datacards depending on the button selected. I know how to do this using a dropdown, but prefer my home screen to navigate and populate the form by button press. 

     

    Thanks agaib. 

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    You don't need to go into specifics. Your problem is you need to identify who is the current user and what is his role. Based on that you can write any complex condition in the visible property of the control. My previous code will give you business area of the admin. Now suppose you only have 2 roles admin and user then you just need to add one line below that code:

    Set(varIsAdmin,!IsBlank(varCurrentUserBusinessArea);

    The above variable will be Boolean value that will tell you weather he is a admin or not. If he is not admin he is user. You can set the conditions based on this variable.

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard