Allow add and edit with condition

Hey, I need to allow to edit/change  fields  in a view  only to the users with sign in email equal to column field "email". The others users can only view and add rows. In others words every users can edit/change only the rows that he has  created. 

Solved Solved
0 12 216
1 ACCEPTED SOLUTION

  1. Go to behavior -> actions and select the Edit action related to your table. You may need to select "Show all" at the end of the page
  2. "Only if this condition is true" should have the rule:
[EmailColumn]=USEREMAIL()

 

View solution in original post

12 REPLIES 12

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Denis_Dal_Soler 

Click on the black pen attached to the column name you wish to restrain:

Aurelien_0-1663051771577.png

 

Then go in the "Update behavior" section:

Aurelien_1-1663051838473.png

click on the potion icon, then use this expression:

 

USEREMAIL()=[Email]

 

Aurelien_2-1663051881155.png

 

For reference:

USEREMAIL() - AppSheet Help

 

 

Many thanks Aurelien. It works but I need that all the columns are restrict (not changeable) by users with mail sign in different from filed "email", not only a single column. In the others hands all the users can insert a new item with all columns. This allow me to avoid that a user changes a column edited by another user.  I hope it's more clear. Thankyou

I'm afraid you will need to use this condition on each column.

As far as I know, there is no global mechanism to avoid users to update a full row.

Ok. I tried but now when I try to add a new item I can't see all the field
hidden. I need this happen only in change not in add row. Thanks

 

@Denis_Dal_Soler 

I think you will need to add a status column to your row, and depending on the status, allow them to update or not.

Here's my suggestion:

- create a new column [Status]

- [Status] has initial value "creation"

- create an action button "switch_Status_to_created" that will be moving this status to "created"

- set this action "switch_Status_to_created" in the form save event

Aurelien_1-1663070063569.png

- change your editable_if condition to:

 

AND(
  USEREMAIL()=[Email],
  [Status]="creation"
)

 

 

I don't understand some details of what you need to accomplish. Nonetheless, in case it's helpful, consider that you can create multiple slices with different edit permissions for each. For example, create one slice that includes all rows and set the Update mode to "Adds"; then create a separate slice that includes only rows where [Email] = USEREMAIL() and set the Update mode to both "Adds" and "Updates".

Thanks @dbaum . So, if I've correct understood, I can:

- make a "View and add" slice where all the users can view all the columns and add new item

- make another  "Change" slice where only the users with [email]=USERMAIL() can show it

Is it correct? If yes how can I select the different show permission for the two  slices?

Thanks very much.  


@Denis_Dal_Soler wrote:

how can I select the different show permission for the two  slices?


I don't know what you mean. In case it's relevant to your question, note that a view baesd on the "Change" slice would only ever show a user their own rows.

Also, be sure to note @SkrOYC's efficient solution of controlling access to the Edit action rather than figuring out how to control the underlying edit permission.

  1. Go to behavior -> actions and select the Edit action related to your table. You may need to select "Show all" at the end of the page
  2. "Only if this condition is true" should have the rule:
[EmailColumn]=USEREMAIL()

 

I thank everyone but this is no doubt the best and faster solution for my issue.

Hi @SkrOYC I can't find "Show all" and relative "Only if this condition is true" in my behavior->Table->Edit form. It appears only "Do this" box but I can't type in. Can you please explain the steps? Thanks.

SkrOYC_0-1663072167567.pngSkrOYC_1-1663072191754.png

SkrOYC_2-1663072216255.png


These are called "System actions", that's why they are hidden at first

Top Labels in this Space