Writeback and Actions: show writeback controls by user
This example builds an incident log in a workbook. When someone opens it, Actions read who is signed in, check that person against the people allowed to make changes, and show the Update and Approve buttons only to them. Those people can then edit an incident in a form and write the change back to the warehouse.
A video walkthrough of the finished workbook is on YouTube.
1. Before workbook opens
Section titled “1. Before workbook opens”A Before workbook opens block runs before the workbook renders. In this example it sets two variables, User Name to the signed-in user’s name and Current Date to today’s date, and logs both. The values come from the Current User and Date & Time context values. Here the two variables are only logged; the update in step 5 reads the user and the date from the context values directly.
2. On entering the incident sheet
Section titled “2. On entering the incident sheet”An Enter block for the incident log sheet runs each time someone opens that sheet. It:
- logs that the writeback authorization check is starting
- calls the Check Authorization procedure (step 3)
- sets the visibility of the buttons from the result
Log blocks write to the browser console, which helps when you debug the sequence. A procedure lets you run the same blocks from several places.
3. The Check Authorization procedure
Section titled “3. The Check Authorization procedure”The procedure compares the User Name variable with the user allowed to update incidents. On a match it shows a success toast and makes the Update and Approve buttons visible; otherwise it shows a warning toast and keeps them hidden. This example compares against a single approved name. In your own workbook, compare against the people who may edit, for example a table of approved users. To show or hide an object, use the Set … container block: choose the button in it, then its Visibility property.
4. Button actions
Section titled “4. Button actions”Each of the Review, Update and Approve buttons has an On click action that switches between the active and inactive versions of the buttons, so the selected one stands out.
5. Writing the change back
Section titled “5. Writing the change back”To update an incident, the user selects a row in the incident table, and its values fill an editable form. The Submit Form button’s On click action then:
- writes the form’s fields to the Incident Metrics Writeback table with a writeback block, together with Updated By (the user’s full name) and Updated At (today’s date and time), so each change records who made it and when
- shows a toast confirming the update
- refreshes the data so the table shows the change
The finished workbook, as seen by a user allowed to make changes:
Next steps
Section titled “Next steps”- Build a smaller writeback first in Write-back 101, which also covers the warehouse grants.
- Make a table editable in Using the Table’s writeback/edit capability.
- See the other triggers in Events (Triggers).





