Allow driver to add new items in inline form but prevent edit other sellers' entry

Hi all, I hope everything is going good

I have a form for tasks and inside it there is an inline form for adding new items. (see below image plz)

we will assign tasks to drivers, but I want to prevent a driver from updating any previous items in the above items inline form. a driver can only add new items but not editing old entries.

Is there any clue plz

Thanks

Set the Child table ADDS_ONLY for drivers from table’s definition. And rest are able as ADDS_AND_UPDATES.

3 Likes

Thank you @AleksiAlkio but this way if I make the child table as adds_only to all drivers then a driver will be able to edit their own record.

I want to allow driver to:

1- add new record

2- update their own record

3- see other drivers’ records without updating.

Then you would need to hide the system generated edit action button if the record is not the driver’s own. For example with USEREMAIL()=[Email]

2 Likes

In addition to Aleksi’s answer, if only the last task needs to have edit rights, you can use MAXROW() in the action behavior field

1 Like

Nothing solved

And what did you try?

1 Like

@AleksiAlkio

For example if I have two users

1- Admin

2- user

Now If I hide system generated edit for user only, then admin will be able to edit the columns but user will not. Even If user is allowed to add new columns and once they save they will not be able to edit. Only admin can edit. This is not the solution I want.

Maxrow also not a good solution as only it shows last row.

So.. as per your responses, the user should be able to edit his/her own items. But you also said.. “a driver can only add new items but not editing old entries.”. I assume with this you mean other driver’s items. If the Admin should be able to edit everyones Items, then you would need to add that condition to Edit action. Don’t know your table structure, but lets assume you have “Users” table with roles. Then the formula would be..
OR(
USEREMAIL()=[EmailColumn],
LOOKUP(USEREMAIL(),users,ID,Role)=“Admin”
)

If you don’t have an “Users” table, then you could write it like..
IN(USEREMAIL(),LIST([EmailColumn])+LIST(“adminA@domain.com”,"adminB@domain.com"))

2 Likes

@AleksiAlkio

Hi, I do not have user table

I will use this

IN(USEREMAIL(),LIST([EmailColumn])+LIST("adminA@domain.com","adminB@domain.com"))

but I could not understand it the right way, how it can allow admin to edit everything and drivers their own

When the app user is the admin, the IN() formula gives the result as TRUE for all rows as it’s not checking any rows to verify it. Meaning.. the result is like TRUE, TRUE etc. for all rows.

@AleksiAlkio

Sorry for bothering you

should I applied in in the action edit button directly or in the table (allowed edit section)

Let me break it down plz:

IN(USEREMAIL(),LIST([EmailColumn])+LIST(“adminA@domain.com”,"adminB@domain.com"))

1- IN(USEREMAIL(),LIST([EmailColumn]) (is this part for admins who can edit all records)

2- LIST(“adminA@domain.com”,"adminB@domain.com")) (and this for drivers)

#1 is for drivers and #2 for admins. And you should use it with the system generated “Edit” action as a condition.

@AleksiAlkio

I tested it and still driver can not edit his/her own record

The authentication is ON in your app? And the email column contains proper driver’s email addresses?

1 Like

@AleksiAlkio Yes

Please take a printscreen from your edit action definitions.

@AleksiAlkio kindly check

It sounds like your formula is just fine. Is the admin able to modify all “Order Details” records?

1 Like

Yes admin can see all records and edit.
Driver can not see all records and can not edit any records including his/her one.