Even if you’re a beginning Coda user, you’re likely well-acquainted with the Detail layout (anytime you expand a row to view the details of it). But if you work on a team with users who have different permissions to view data, did you know those layouts can actually be used as a pseudo-permissions management system?
Today I’m going to tell you about a bit of a power-user trick to ensure that only people with certain roles can view the detail or edit parts of your data by leveraging detail layouts. It's a bit of a more long-winded post - but if you're into fun Coda tricks this post is for you! If you're a visual learner instead, I have this whole walkthrough in video as well.
Roles Table
First, you’re going to need a table that sets the permissions that people have in your doc for detail views. The easiest way to do this is create a table and add the person’s email address and their role in the doc. For the sake of this example, we’ll assume you have some sort of a doc where team members can submit ideas (Submitter), and then someone else approves them (Designer).
Main Table and Views
From here it gets a bit more complicated, so stick with me! Now you’re going to need the original table of data - all the information about the project, task, whatever.
In our situation, we are pretending that we have a task table with two end user groups:
- Designers (People who need to complete design related tasks)
- Submitters (People who submitted design tasks to be completed)
Now copy and paste the table and name it “VIEW - Designer”, and paste the table again and name it “VIEW - Submitter.”
Now that you have your two new views, you're going to need to go ahead and edit the layouts of those view. This is where you are going to start defining rules around who gets to view or edit what data.
If you don't know how to edit layouts of tables, simply click the vertical ellipsis (3 stacked dots) next to a table and choose Edit layout.
If you only have one layout right now, go ahead and rename it to “Designer” and show or hide the columns you want the Designer roles to see. Once you have that set, you can click the vertical ellipsis in the Edit layout and choose “Duplicate.”
Rename it to “Submitter” and hide or show any columns you want visible only to the Submitter roles. And once more, “Duplicate” the view and now we’re going to do a bit of a silly trick that I promise will be important later.
Name this new view “Default,” and hide every single column. Create a new column and type the following in as a formula (Calculate column type), quotations and all: “Please click the Open button to view details about this row.” And then show only this row on your Default view. Feel free to make it big, center it, remove the column label, etc. so that sentence is the thing that stands out.
Table Layouts
Alright! So now you've made three different table/detail layouts for a your tasks table:
- Designer layout
- Submitter layout
- Default layou
Now you need to make sure that the table layout views match the table title.
For your “VIEW - Designer,” open a row, click the vertical ellipsis, Edit layout, and choose “Designer”.
For your “VIEW - Submitter,” open a row, click the vertical ellipsis, Edit layout, and choose “Submitter”.
And for the table which users will actually work out of, choose the "Default layout"
The Button
Now let’s make a button that will conditionally show the correct layout to a user depending on their assigned "role". I like to name the column “Open.” (I know, so descriptive.) In the button settings, you’re going to type the following formula:
Basically you’re saying, “Hey Coda, look at the Roles table and if the person who is using this doc’s email is in the table, look at their assigned role. If they’re a Designer, show them the Designer layout view when they click this button. Otherwise, show them the Submitter layout view when they click this button.”
The Silly Part
Now you might be wondering, “Hey Scott, what if a person doesn’t click the Open button to see something and they just try to expand the row?” Well, this is where that silly little “Default” layout text you made comes into play. On your main table, open a row, click the vertical ellipsis, Edit layout, and choose “Default”.
Now if someone tries to expand the row, the Default view is that text prompting them to use your button!
You’re all set to leverage the power of detail layouts in your doc! Will this be part of your Coda workflow?
Enjoyed learning more about Coda with this post and want to learn more? From Coda lover to Coda lover, we've selected some other interesting and useful resources we think you'll love. Check them below👇