What it does

This example is a pair of Add-Ins. Lock Record freezes a Record so that only a chosen team can change it, and records why. Unlock Record opens it up again. Use them when a Record must not change while it is under review, in a dispute, or being audited, and you want managers to be able to do this without an administrator.


A locked Record is read-only for everyone except the user or team it is locked for. That includes administrators: they cannot edit a locked Record unless they are in the team it is locked for.


Settings for both Add-Ins

Create two Add-Ins, Lock Record and Unlock Record, and set up each one the same way:

  1. Under General Settings, set Type to Actions Only.
  2. Under Where/When to Show, turn on the Record location, and use Record Types to limit it to the Record Types that can be locked.
  3. Set the option to Add-In will refresh the Record/Viewer screen after running, so the screen switches between read-only and editable as soon as the Add-In finishes.
  4. Under When to Show, add a Team Check rule set to Current User and In Team, and choose the team allowed to lock and unlock Records, such as Managers.


To show only the button that makes sense, add a Record Value Check rule to the same rule set, on the field @LOCKUSER, which holds the lock:

  • On Lock Record, set the value to #, which matches a blank value, so the button shows only when the Record is not locked.
  • On Unlock Record, set the value to *, which matches any value, so the button shows only when the Record is locked.


Lock Record

Under Data Entry Options, click Add Prompt Value and set Field Name to a field such as LockReason. The user types the reason when they click the Add-In, and it is saved to that field before the actions run. Set Title Text to something like "Lock this Record".


Under Record Actions, add:

  1. Lock Record, with the Record ID left blank so it locks the open Record. In Locked For, enter the name of the team that may still edit the Record, such as Managers. Use the team's name, not a number: a number is read as a user's ID.
  2. Add Record Note, with text such as "Record locked by [USERFULLNAME]: [LockReason]".


If Locked For is left blank, the Record is locked for the user who clicked the Add-In, and everyone else, including other managers, can only read it.


Unlock Record

Under Record Actions, add:

  1. Unlock Record, with the Record ID left blank so it unlocks the open Record.
  2. Add Record Note, with text such as "Record unlocked by [USERFULLNAME]".


Optionally add a Record Multi-Value Update action that sets LockReason to [DEL], so the old reason does not linger on the Record.


Using it

Open the Record and click Lock Record. Enter the reason and click Save. The Record becomes read-only for everyone outside the team, and the button changes to Unlock Record. To release it, a member of the team opens the Record and clicks Unlock Record.


Notes

  • The Record screen does not say why a Record is read-only. To make the lock obvious, create a third Add-In with no actions, shown as a Record Banner with Show as Record Banner (top of Record screen), banner text such as "This Record is locked", and the same @LOCKUSER rule as the Unlock Add-In.
  • A Record has only one lock at a time. Locking a Record that is already locked replaces the earlier lock.
  • Unlock Record removes the lock whoever it belongs to, so anyone who can see the Unlock Add-In can unlock any Record. Keep the Team Check rule on it.
  • There is no expiry. A locked Record stays locked until an Unlock Record action runs.
  • The lock controls what people can change on the Record screen. Workflow actions and Add-Ins can still change a locked Record's data.