cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pxtavern
Helper II
Helper II

Limit a choice field for some users, but make all choices available for a specific user

Hi 

 

I have a choice field "Stage" with 3 choices. "Stage 0" , "Stage 1" and "Stage 2 - Approved"

 

I want to make it so that regular users will only see stage 0 and 1. I have been able to do this using this:

If(Or(ThisItem.Stage.Value = "Stage 0" || ThisItem.Stage.Value = "Stage 1" ,
Filter(Choices(Roadmap.Stage),
Value = "Stage 1" || Value = "Stage 0"),
Choices(Roadmap.Stage)
)

 

 

However, I also want to make it that 1 person is able to come in and make the value state "Stage 2 - Approved" I believe this is the correct If statement:


 

If(User().Email = "email@address.com",
Filter(Choices(Roadmap.Stage),
Value = "Stage 1" || Value = "Stage 0" || Value = "Stage 2 Approved"),
Choices(Roadmap.Stage)

)

 

 

I can get the two if statements to work alone but not together. Does anyone have any idea how to make this work? Very much appreciate anyone who can help 

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User
Super User

@Pxtavern 

Please consider changing your Formula to the following:

Filter(
    ForAll(Choices(Roadmap.Stage),
        {Value: If(!(User().Email = "email@address.com") && Value = "Stage 2 Approved", Blank(), Value)}
    ),
    !IsBlank(Value)
)

 

This should provide what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Pxtavern
Helper II
Helper II

Worked it out, was over complicating it. For anyone who wants to know the fix is:

If(User().Email = "email@address.co.uk",
    Filter(Choices(Newtestlist.Status),
    Value = "Stage 0" || Value = "Stage 1" || Value = "Stage 2"),
    Filter(Choices(Newtestlist.Status),
    Value = "Stage 0" || Value = "Stage 1")
)

 

basically creating do X else do X

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@Pxtavern 

Please consider changing your Formula to the following:

Filter(
    ForAll(Choices(Roadmap.Stage),
        {Value: If(!(User().Email = "email@address.com") && Value = "Stage 2 Approved", Blank(), Value)}
    ),
    !IsBlank(Value)
)

 

This should provide what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Pxtavern
Helper II
Helper II

Worked it out, was over complicating it. For anyone who wants to know the fix is:

If(User().Email = "email@address.co.uk",
    Filter(Choices(Newtestlist.Status),
    Value = "Stage 0" || Value = "Stage 1" || Value = "Stage 2"),
    Filter(Choices(Newtestlist.Status),
    Value = "Stage 0" || Value = "Stage 1")
)

 

basically creating do X else do X

RandyHayes
Super User
Super User

@Pxtavern 

You're still overcomplicating it!

It is a bad practice to specify more than one filter in your Items property.  You have your logic outside of the filter and thus are forced to create two.

 

Please consider changing your Formula to the following:

Filter(
    ForAll(Choices(Newtestlist.Status),
        {Value: If(!(User().Email = "email@address.com") && Value = "Stage 2 Approved", Blank(), Value)}
    ),
    !IsBlank(Value)
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you for your help that has worked as well 🙂 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,204)