Set Write Premissions to Fields
Hey, I want to give write permissions to fields on my form.
I created 6 roles and assigned them to the users, everything fits.
As I said, now I want to assign the roles to the fields. For example.
First field - Role 1
2nd and 3rd field - Role 2, but everyone should be able to read the fields

Set the Enabled property based on the result of CheckRole<>:

What did you Configure behind "UserHasRole1"?


Hi Aleyna,

Here you go:

Note that you need to check this in your Save action also.

This may be done using the Enabled Property, which is an expression. To enable or disable the field based on role, follow the steps below.

1. Create data actions for determining whether a role is true or false for all roles.

2. Set the enabled property of the textbox using the Output of data action which you wanted to check.

Note: Because this is a client-side only solution, please double-check the fields against the role before saving the data in the database.

How can I create this flow, unfortunately I can't imagine it, I'm still a beginner

Hi,

The role is something on server, cannot use it directly on client side.

Firstly, need to use fetch from other source. In that, you can use the built-in check role and return true if user has that role, else return false

Secondly, use the return value from the fetch above, and do like @Arnold Jr Ayaoan and @Mayank Dharmpurikar s'guideline above 

Hope this help

Thanks and best regards

Shingo

I've attached the OML for your convenience.

Follow the procedures below to inspect the attached OML. -

1. First, make the module available in your environment.

2. Using the Users application, create three users with the appropriate roles (User1-Role1, User2-Role2, and User3-Role3).

3. Login with each user individually and inspect the ProductDetail page, where the field is implemented using the logic below.

FieldNameRole1 PermissionLevelRole2 PermissionLevelRole3 PermissionLevel
NameRead/WriteReadRead
DescriptionRead/WriteReadRead
QuantityRead/WriteRead/WriteRead
PriceRead/WriteRead/WriteRead

4. Check it out the code.

RolesChecking.oml

Hi,

I'd use the 'Enabled' property for this. Make a check for the user roles prior to the page loading, assing it to a screen List variable containing all the hasRole values. Afterwards, you just have to assign the variable to the fields.

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