This article explains how to add a rule based Lock to a Form to prevent users from adding or editing Records, according to that rule. This type of Lock uses a Formula to determine whether or not a Record should be locked and can be applied to Forms.
By adding a rule based Lock you can preserve versions of the Records (after they have been validated by your information management processes, for example) and make sure that no user can edit them.
A rule based Lock is applicable only to Forms and Subforms. You can add a rule based Lock to a resource using a Formula. You might want to relate the Lock to criteria other than dates, such as region or type of response, for example. The Formula must have a boolean-typed result. If a Record of a Form is locked, then the Records of the Form's Subforms will be locked as well.
The property 'active' allows you to temporarily suspend a Lock.
Alternatively, you can add a date range Lock.
How to add a rule based Lock
- Before adding a rule based Lock to your Form make sure that the Form contains the field on which you will base your rule and that this field has a boolean-typed result.
![](https://www.activityinfo.org/support/screenshot/cn81rzuls6bhsq85h.png)
- On the Database List page, click on the Database that contains the Form you want to add a rule based Lock to.
![](https://www.activityinfo.org/support/screenshot/cf4x0l2ls6bht4f5i.png)
- Click on "Database settings" to open the Database Settings page.
![](https://www.activityinfo.org/support/screenshot/cafd1irls6bht4v5j.png)
- Navigate to the resource to which you want to add the rule based Lock. Click on the arrows to reveal the contents of Folders, if needed.
- In the Resource side panel of the Database Design section, click on "Locks" to open the Locks tab.
- Click on "Add rule based lock".
![](https://www.activityinfo.org/support/screenshot/cpfeoahls6bhtin5k.png)
- Give a descriptive name to the Lock.
- Type the message you would like data entry users to see when a Record is locked.
- Type in the Formula for the rule or click on 'Formula editor' to open the Formula editor to view all fields.
- When checking the box 'Active' the Lock remains active. If you uncheck it you suspend the Lock from being active temporarily. You will still be able to view it it in the side panel.
- Click on "Save" to save the Lock.
![](https://www.activityinfo.org/support/screenshot/ci8cdgcls6bhtja5l.png)
- When users try to add a Record that goes against the rule they will get a warning and won't be able to save the Record.
- When an existing Record is affected by the rule based Lock, users won't be able to edit it.
![](https://www.activityinfo.org/support/screenshot/cbe3xg6ls6bhu2c5m.png)