cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Post Partisan
Post Partisan

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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,568)