cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RajSaha_
Helper IV
Helper IV

How to hide the button based on the user and value

Hello All,
when ever user login how see the button subscribe and unsubscribe button based on the user.
if value is false user can see subscribe button 
if value will true then user can see unsubscribe button
ppp.png

 
 
 
 

 

 

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@RajSaha_,

Combine that with your description, I sum all up as below:

  1. Subscriber is a Person type and the 'Subscribe for Alerts' is a Yes/No type
  2. Once a subscriber have a true value corresponding to the  'Subscribe for Alerts', unsubscribe button is visible, otherwise subscribe button is visible.

I have a test on my side, please take a try as below.

In my scenario, I have a Person column named 'Staff' and a Ye/No column named 'Subscribe for Alerts'.

Set the Subscribe Button Visible property:

If(
    LookUp(
        GT,
        Subscriber.Email = User().Email,
        'Subscribe for Alerts'
    ) = false,
    true
)

Set the Unsubscribe Button Visible property:

If(
    LookUp(
        GT,
        Subscriber.Email = User().Email,
        'Subscribe for Alerts'
    ) = false,
    false
)

006.png

You could see that Qi Qiao is the current logged user, and this user has a false value according to the Subscribe for Alerts, so the Subscribe Button is visible for her.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

9 REPLIES 9
eka24
Super User
Super User

Am assuming you have a UserTable with true and false column. In that case, create a variable in in OnStart of the App:

Set(varUser,LookUp(UserTable,UserColumn=User().Email,TrueFalseColumn))

 

Then in the Visible of the Button: varUser

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

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.

RajSaha__0-1610031538121.png

 

@RajSaha_ ,

Is your Subscriber column a person type in sharepoint ?

If so...use:

Set(varUser,LookUp(GT,Subscriber.Email=User().Email,"Subscribe for Alerts'))

Also I'm affraid of a delegation warning  invoking User() function inside formula, so to be sure you avoid that, use:

Set(currentUserEmail,User().Email);

Set(varUser,LookUp(GT,Subscriber.Email=currentUserEmail,'Subscribe for Alerts'))

 

Hope it helps !

eka24
Super User
Super User

What Data type of column is the Subscriber?

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

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.

RajSaha_
Helper IV
Helper IV

Suppose I have logged in to the application if the Subscribe for Alerts value is 'false' then I can see Subscriber button.
If you have logged in the application if the Subscribe for Alerts value is 'true' then I can see unsubscribe button.

RajSaha__0-1610034086301.png

Data sauce I'm using SharePoint 

@RajSaha_ ,

To corect the error read my reply above. 

RajSaha_
Helper IV
Helper IV

RajSaha__0-1610034563288.png

 

v-qiaqi-msft
Community Support
Community Support

Hi@RajSaha_,

Combine that with your description, I sum all up as below:

  1. Subscriber is a Person type and the 'Subscribe for Alerts' is a Yes/No type
  2. Once a subscriber have a true value corresponding to the  'Subscribe for Alerts', unsubscribe button is visible, otherwise subscribe button is visible.

I have a test on my side, please take a try as below.

In my scenario, I have a Person column named 'Staff' and a Ye/No column named 'Subscribe for Alerts'.

Set the Subscribe Button Visible property:

If(
    LookUp(
        GT,
        Subscriber.Email = User().Email,
        'Subscribe for Alerts'
    ) = false,
    true
)

Set the Unsubscribe Button Visible property:

If(
    LookUp(
        GT,
        Subscriber.Email = User().Email,
        'Subscribe for Alerts'
    ) = false,
    false
)

006.png

You could see that Qi Qiao is the current logged user, and this user has a false value according to the Subscribe for Alerts, so the Subscribe Button is visible for her.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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