163
Views
11
Comments
only users with permission can edit
Question
Application Type
Reactive

Hello,

I would like the field to be unavailable for editing. and that only users who have permission can change


How can help me??

2023-10-21 19-42-11
Tousif Khan
Champion

Hello

In  the Enable Property of you Input field you have to check the Role,

So first you need to create Role then you need to give the roles to that user or group of users whom you want access to edit the input field, So if you only want to give the read-only access then 
Check the Role in the Enable property of your Input. Ex:

if(IsAdmin,True,False)

I am attaching some reference link that will help you with check role functionality

https://www.outsystems.com/forums/discussion/78410/how-to-give-visibility-of-container-widgets-and-button-widget-based-on-roles/

Since we have a lot of similar Post you can refer to them here:
https://www.outsystems.com/forums/Search.aspx?page=1&q=Check+Role&scat=forums

Hope this helps 
Thanks
Tousif Khan

2022-05-02 13-50-49
Paulo Ritto

Hi @Pedro Faria ,

For enabling/disabling a field, you have the Enabled property that you seem to be already using, where you can provide a specific condition. 

I'm assuming you are managing your user permissions through the use of roles.

In that case, you can create a data action in your screen, called GetRoles, where you call the checkRole for the current user (getUserId()), and return a boolean as output, stating if the user has that role or not.
After that, you can just use that output on your enabled property of your field.


Let me know if this helps!

Cheers,

Paulo

2025-07-31 10-32-21
Vikram garasiya

 @Pedro faria


Hi,

you can enable or disable field as per requirement by just putting specific condition in enabled Property of field.

In enabled property of particular field check role of user who ever login.

 

2022-05-02 13-50-49
Paulo Ritto

@Vikram garasiya , the whole point is that he cannot use default checkrole functions on input client-side property.

2025-07-31 10-32-21
Vikram garasiya

So @Paulo Ritto, what  he can do is firstly he will check the role of user who ever login and take it in Boolean type variable and based on that variable he can do so.

2020-02-28 09-46-54
Eduardo Jauch


It's possible to use the Data Action approach, that returns true i the user has the role, false otherwise, as the data action is executed server side and the Check<role>Role works there.

But then, it has to be done on every screen where it is needed.

I prefer the Client Action approach, where you run a small javascript code that returns if the user has the role. This way, you can create a generic function that check the role client side and can be used on the Initialization event, for example, while the data action can't.

https://visualcodify.com/2021/06/26/outsystems-role-based-security-on-screen/

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

However, one must not forget that everything client-side can be tampered with, so you do need checks server side when saving data.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Pedro,

There's multiple things you can do. As others have already suggested, you can check the Role and toggle the Enabled property based on that. As an alternative, you could either use an If to replace the Form with inputs for static text, or use multiple Ifs to replace each input box for static text.

Note that since it's Reactive, all checks are done client-side and can be tampered with, so make sure that all Save actions server-side also check the Role! 

UserImage.jpg
Pedro Faria

Hello,

I tried to do it that way, but I couldn't

Can help me?

2025-07-31 10-32-21
Vikram garasiya

Can you please share your OML so I can take reference

2025-09-25 14-38-22
Lokesh Kumar Yadav

Hi Pedro,

Please see the attachement it will help you to clear your senario

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