Hi,
I’m using this template: https://www.getgrist.com/templates/recruiting-template
Is it possible to control access to specific rows? For example, I want to ensure that user1@test.com only sees the rows where the role is Master Tailor.
I tried the following condition:
rec.Email == "user1@test.com" and rec.Role == "Master Tailor"
Unfortunately, it doesn’t seem to work. Any suggestions on how to achieve this?
Hi there!
Access Rules can be a bit tricky especially when one of the columns is a Reference column. Reference columns store a record’s ID so when using access rules, there’s no way to get any other information from the referenced record. The Role column in the Candidates table shows the Role as the label, but it’s actually only storing the record ID. We need to add a formula column to pull specific information (like Role) into the table to compare to.
First, add a new column to the Candidates table with the formula $Role.Role
. This will pull the actual Role value into the record.
Next, you’ll add your condition in Access Rules for the Candidates table.
user.Email == "user1@test.com" and rec.Role_ACCESS_RULE == "Master Tailor"
We want to check the email address of the logged in user and we also want to check the value in the Role - ACCESS RULE column of a record. If the email address is user1@test.com
and the value in the Role - ACCESS RULE column is Master Tailor
, then this condition applies.
See this in action here: Community #6951 - Grist
Thanks,
Natalie
Thank you verry much for your response! Access rule worked perfectly.