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 Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (2,408)