change visibility of a button by user role in mobile application

Hello everyone,

Outsystem10, mobile

I am trying to replicate the operation of my web application, trying to make a button visible according to the user's role, I have searched for information and made it through Javascript, but I do not know how to apply the code checkIfCurrentUserHasRole (roleKey: string ) in my app

Thank you

Hi,

In the documentation of the method you have an example where you save the result in the parameter IsManager. Than you just need to use that to show or not the button.

Regards,

Marcelo

Solution

Hi Maroan,

In attachment you'll find an example of how to do this using the 'fetch data from other sources' action which works like a pseudo preparation in this case. (it'll perform the logic to check roles before passing on the result towards the screen where the button's 'visible' attribute is determined by the result.)

Kind regards,
Glenn

Solution

Thanks for replying

I followed his example and created actions that sought data from other sources. there I could validate the user by role and return true or false to apply visibility of the button.

I could not follow the example of javascript since in my version of outsystems there are no local user variables, nor could I create a user action.


Thanks.