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 / Power App - limit the ...
Power Apps
Unanswered

Power App - limit the options available in a choice field based on current login user

(1) ShareShare
ReportReport
Posted on by 75

 

Power App - Is it possible to limit the options available in a choice field based on current login user?

I have a submission status choice field in my current app. Is it possible to limit the options available in choice field based on user? for example, Approve, Reject and On Hold for approver; Not Ready For Review and Pending For Review for general users. Please see attached snapshot.

 

Thank You

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Hi Ruth Dong,
    Assuming you have a Variable to indicate the user's role
    If(
       RoleVariable = "Approver",
       ["Approve", "Reject", "On Hold"],
       ["Not Ready for Review","Pending for Review"]
    )
  • redeagle Profile Picture
    8 on at
    Hi,
     
    as always there is several options and the best solution depends on your use case.

    The solution Warren proposed is sure nice and easyand it will be no problem to implement with a small number of people in your groups. you may set a global variable when your app starts with a command like:

    If(User().Email in "john.doe@contoso.com homer.simpson@contoso.com jane.smith@contoso.com",
         Set(RoleVariable,"Approver")
    )
     
    But if you got more roles, larger number of people in a role or frequent changes, then there might be a better way.
    You can use SharePoint groups.

    First you need to create a group on your sharepoint for each role.
    Then you create a list with all items for your dropdown.
    Make sure, you personally have full access for later changes.
    In SharePoint you can set rights for each item of that list and allow read access for the appropriate role(s).
    Then remove the common member/visitor(/owner) groups.

    Now you can point the items property to your new list and each user will only see items, they are allowed to see, depending on the role group(s) they have in sharepoint.

    The advantages are, that there is no programming needed, you can manage roles in sharepoint, users can have multiple roles and you can easily change, which items are visible and selectable for each group, without changing the app.
  • Ruth_Dong Profile Picture
    75 on at
    Hi @WarrenBelz  and @redeagle 
     
    I created a solution based on both of your feedback. I don't get any error.  But, the output is not what I expected. 
     
    My email address is in the RoleVariable as the approver.  It turned out my submission status options are Not Ready For Review and Pending for Review.  I am not sure I set up the RoleVariable correctly or not. 
     
     My expected result should be Approve, Reject and On Hold for approver since I am in the approver.   Please help!
     
    Thank you in advance!
     
  • acharette_kiimk Profile Picture
    6 on at
    Hey Ruth, 
     
    In the code you just posted, the conditional statement in your Items attribute should be: 
     
    If(RoleVariable = "Approver",
      ["Approve","Reject","OnHold"],
      ["Not Ready for Review", "Pending for Review"]
    )
     
    as suggested by Warren.
     
    However, I'm assuming this is a form, and if you have an Approver field with a lookup, you could do the following:
     
    If(ThisItem.Approver.Email = User.Email(),
      ["Approve","Reject","OnHold"],
      ["Not Ready for Review", "Pending for Review"]
    )
     
    Alternatively,
     
    If(ThisItem.Author.Email = User.Email(),
      ["Not Ready for Review", "Pending for Review"],
      ["Approve","Reject","OnHold"]
    )
     
     
  • Ruth_Dong Profile Picture
    75 on at
    I updated the condition in the Items property based on your suggestion.  It does not fix the issue.  I am still getting incorrect output. Please see snapshot  Please help. 
     
    It is form that is based on SharePoint list.  And, I customized the form with Power App.  I am new to Power App. 
     
    - what do you mean by " if you have an Approver field with a lookup" ?  Are you referring to an additional or separate SharePoint list that contains a list of approvers?  Can you please provide some screenshots of your suggestions?
     
     
    Thank You
     
  • acharette_kiimk Profile Picture
    6 on at
    Can you create a text label and set the value to User().Email? I suspect that the OnStart condition isn't working properly, assuming that you remembered the run OnStart (right click on App -> Run OnStart). 
  • Suggested answer
    DorottyaBH Profile Picture
    2 on at
    Hi Ruth, 
     
    An easy way to maintain the user information is to create a new Sharepoint list, where you enter the users with their roles. Then you connect your new Sharepoint list to your app
     
     
    Then create a variable OnStart of you app: 
     
    Here is the expression: 
    Set(
        UserRole;
        LookUp(Benutzerdatens; 'Email Adresse' = User().Email; Rolle)
    )
     
    Note, that in my case the table is named "Benutzerdatens" and the column, which contains the user roles is named "Rolle". 
    You will need to change them to your respective table and column names. 

    Then you run OnStart: 
     
    This step is crucial, since it actually creates the variable. 
     
    You can add a label control to check the content of your variable. For that, you simply add the varible to the Text property of your label:
     
    If that works well, you can proceed with the items property of your choice field:
     
    If(UserRole = "Approver",
      ["Approve","Reject","OnHold"],
      ["Not Ready for Review", "Pending for Review"]
    )
    Let me know, if that worked out!

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard