Conditional Filters for Record Permissions Using Roles | INTERMEDIATE
In Quickbase you can set detailed, custom permissions for any role by using conditional criteria to grant access to records based on information contained in a record.
For any role, you can set view access and modify access to allow users in that role to view or modify ‘All records’, ‘Group records’, ‘None’ (no records), or you can set a ‘Custom Rule’ using conditional filters. In this article you’ll learn how to utilize these custom rules.
Why would you want to set a custom permission for a role in one of your tables? Here are a few examples:
✓ Only allow employees to view their own timesheets
✓ Only allow Project Managers to edit projects they created
✓ Disallow Sales Associates from viewing Opportunities marked as ‘Archived’
In this article we’ll look at the first example: Only allow employees to view their own timesheets.The idea here is that you want to only allow users in the participants role to view the timesheets where they are listed as the employee. Let’s look at how we might set this up:
Go to your timesheet table and identify the field where the username is entered. In this example the field is called: ‘Employee’. Remember the name of your field.
Navigate to table ‘Settings’ and select the option ‘Access’ 3. In the participant role click the dropdown field in the ‘View’ column:
- A new tab will open in your browser allowing you to select the conditions under which you would like the role to ‘view’ records. This is very similar to how you would configure a Quickbase report:
In this case we will select the condition ‘When the employee is the current user”. This means records will only be shown to a user if the user entered in the ‘Employee’ field is the same user they are logged in as.
EDITORS NOTE: If you added this custom rule to ‘Modify’ , rather than ‘View,’ the user would be able to view all records, but only modify (edit) records where the ‘Employee’ is the current user.
In some cases your organization may want to require timesheets be completed during the current week. We can set an additional level of custom access using the ‘Modify’ drop down.
To do so:1Start by creating a formula checkbox field named “Current Week?” and add the following formula:
FirstDayOfWeek([Date])=FirstDayOfWeek(ToDate([Today])) and FirstDayOfMonth([Date])=FirstDayOfMonth(ToDate([Today])) and FirstDayOfYear([Date])=FirstDayOfYear(ToDate([Today]))
This will cause the field to be checked if the timesheet is entered during the same year, month and week.
In the participant role click the dropdown field in the ‘Modify’ column and select ‘Custom’
Now set the conditions as shown in the pic below:
- Save and return to your time sheets. Now you will notice that you can no longer edit timesheets from previous weeks.
To learn more ways to leverage roles and permissions click here to view a library of articles.
- Author: Jake Rattner (firstname.lastname@example.org)
- Date Submitted: 2/13/2019