25
Views
14
Comments
Solved
Hide Button

Hi,


I have a button for each user I create.

When I log in with a user I wanted that user's button not to appear

How do I hide the button?

I already searched the forum and from what I realized I have to put an if around the button ..... I don't know is what expression I should use

https://www.outsystems.com/forums/discussion/65243/hide-button-enclose-in-if/


Thanks

Rank: #70
Solution

Hi SpiritFox,


If you want the user in session not to be displayed in the dropdown, you need to add a filter to the query binded to the dropdown "User ID Recebe". This filter should be User.Id <> GetUserId() 


In this way, the current user would not be in the dropdown possibilities.


Let me know if it works for you.

João

Rank: #70

Hi SpiritFox,


You are right, you can enclose it on an if and establish the condition for it to show, in your case the user id should be different than the user in session which you can get using GetUserId ().

So your if condition should be UserId <> GetUserId() where UserId should be replaced by the user id of the user you want to hide the button from.


Hope it helps.


Regards,

João

Rank: #128

Hi SpiritFox,

If your list of buttons is based on result of aggregate, you could also add filter user.id <>  getUserId() in the aggregate.

Dorine

Rank: #3307

Hi,

Set the button's visible property to not checkuserRole(UserId;). (If you give them their role)


Regards,

Aakash


Hi,

please follow the steps below to hide and display the button based on logged in user - 

1. Add the buttons under true and false branch of the if block - 

so if the condition matches it will show the "Ok" button or else it will show the "Save" button on UI.

If you want to check the assigned role then just replace the condition with checkuserRole(UserId;).


Let me know if this helps.

Thanks,

Unnati