199
Views
14
Comments
Solved
screen visibility

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

2026-01-19 17-09-56
Carlos Lessa
 
MVP
Solution

To give you context:

I added a boolean local variable: HasManagerRole

Added event onReady to the page

Javascript checking the role with output parameter IsManager: $parameters.IsManager = $public.Security.checkIfCurrentUserHasRole($roles.Manager);

Condition of if: Local variable HasManagerRole



Hope I could help you

Best Regards

Carlos Lessa

2024-06-19 07-19-32
JitendraYadav

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me


Hi,

Is that for Tradition web application? If yes, you can access roles directly in if conditions like below snap,

UserImage.jpg
harish sharma

JitendraYadav wrote: Hello Jitendra.

This is Traditional web app but if condition is not assess role  directly.

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me


Hi,

Is that for Tradition web application? If yes, you can access roles directly in if conditions like below snap,



2024-06-19 07-19-32
JitendraYadav

harish sharma wrote:

JitendraYadav wrote: Hello Jitendra.

This is Traditional web app but if condition is not assess role  directly.

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me


Hi,

Is that for Tradition web application? If yes, you can access roles directly in if conditions like below snap,




Use CheckRegisteredRole in if conditions like

CheckOSMDbAdminRole(UserId:) = Rolels.Admin

2024-06-19 07-19-32
JitendraYadav

Also, Sharing OutSystems Training link which was already covered roles exercise.


https://www.outsystems.com/learn/lesson/883/security-exercise


Thanks

2026-03-09 12-26-51
Fábio Fantato
 
MVP

All roles you have created in your application has the Check, Grant and Revoke actions available. So you just need to use the CheckApp1Role(UserId) that returns a boolean.


2026-01-19 17-09-56
Carlos Lessa
 
MVP

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa

UserImage.jpg
harish sharma

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



2026-01-19 17-09-56
Carlos Lessa
 
MVP

harish sharma wrote:

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



Did you create the ManagerRole? 

Right click on role and add the role you need


Can you take a pic from the roles? and from the if condition?


UserImage.jpg
harish sharma

Carlos Lessa wrote:

harish sharma wrote:

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



Did you create the ManagerRole? 

Right click on role and add the role you need


Can you take a pic from the roles? and from the if condition?




2026-01-19 17-09-56
Carlos Lessa
 
MVP

harish sharma wrote:

Carlos Lessa wrote:

harish sharma wrote:

Carlos Lessa wrote:Hi Carlos.

Thank you.

i Did the same but in if condation Role(CheckMAnagerRole(UserID:) is not appear. 

harish sharma wrote:

hi team.

i have 2 screen one is Employee screen and second is Employee Details screen.

i create 2 role 1. Manager  2.Employee.

In Employee Screen there is Add employee Button. i want to hide this button for Employee. so i add enclose in if condition but role is not appear in condition area. please help me

Hi Harish here is a screenshot of what you need to do:

1 - Need to have the role you want to check against (Manager in your case)

2 - Use the Check from this role in the IF condition - CheckManagerRole(UserId:)

3 - Get the user logged in - GetUsedId()

4 - Apply on the condition the combination - CheckManagerRole(GetUsedId())

Check the documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application

I would advise that when you have extra time, follow the online training (Reactive Web, Mobile, Traditional Web) that will give a lot of information and help on your projects(in case you didn't)

Best regards

Carlos Lessa



Did you create the ManagerRole? 

Right click on role and add the role you need


Can you take a pic from the roles? and from the if condition?




you didnt send pic from the condition on the if?

to be fast or help you best, can you upload the oml?


2026-01-19 17-09-56
Carlos Lessa
 
MVP

I got it, you are using Reactive web app and CheckRole function works in server-side so you cant use on reactive and mobile

to check the role you need to use OutSystems JavaScript API 


2026-01-19 17-09-56
Carlos Lessa
 
MVP

Check what I did in this oml and replicate on yours



UserRoles.oml
2026-01-19 17-09-56
Carlos Lessa
 
MVP
Solution

To give you context:

I added a boolean local variable: HasManagerRole

Added event onReady to the page

Javascript checking the role with output parameter IsManager: $parameters.IsManager = $public.Security.checkIfCurrentUserHasRole($roles.Manager);

Condition of if: Local variable HasManagerRole



Hope I could help you

Best Regards

Carlos Lessa

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.