cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Super User
Super User

Only allow person from a variable look up to use a toggle

Hi there, 

 

I have a variable OnStart of my app which looks up whether the person using the app is on a Dataverse table. If they are, they can do certain things in my app which others can't. This variable is called "IsPriv"; meaning "Is Privileged". 

 

I want to use this variable to ensure that only those where IsPriv = true, can use a toggle control, otherwise they get a Notify message saying that they don't have permissions. Please can someone advise on the code for this?

 

Many thanks

K.

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

In the DisplayMode of the Toggle:

If(IsPriv,DisplayMode.Edit,DisplayMode.View)

 

Then Inside a Label beside or below the Toggle with:

"You cant use a Toggle" in the Text Property.

 

Then set the Visible of the Label to: IsPriv

 

If it doesnt work, show the formula for the Variable.

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

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Please Subscribe to my Youtube Channel

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

In the DisplayMode of the Toggle:

If(IsPriv,DisplayMode.Edit,DisplayMode.View)

 

Then Inside a Label beside or below the Toggle with:

"You cant use a Toggle" in the Text Property.

 

Then set the Visible of the Label to: IsPriv

 

If it doesnt work, show the formula for the Variable.

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

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Please Subscribe to my Youtube Channel

@eka24 

Thanks - this works.

 

When the Privileged user now selects the toggle, a pop up appears with a combobox. When they enter a person into this combobox and hit Submit, it adds the Display Name of the person from the combobox to a variable called "LondonDelPerson". 

 

On my patch command (this is a deskbooking app), a column name is 'LDN Desk Reserved For:'   - I want this to patch the LondonDelPerson's name if the variable is not blank, otherwise patch the user's name (User().FullName).

 

Any ideas?

 

I was trying Text(If(!IsBlank, LondonDelPerson, User().FullName)   but get an error?

 

Thanks

K.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,031)