How to Configure Record Locking Mechanism for HEAT 2014.x?
1. Create three fields in the business object (such as incident).
2. Add an initialization value.
3. Add a before saving rule.
$(if AA_LockedBy == CurrentLoginID() &&
DateDiff("second", now(), AA_LokedDateTime) > 2
4. Create a quick action called Lock.
5. Build a label control in the desired form.
The following is the label expression:
then "Incident is locked by " + AA_LockedBy + " -> " +
ToString(DateDiff("minute", now(), AA_LokedDateTime) + " minutes")
else " ")
The following is the label style expression:
$(if AA_Lock == true then "Lock" else "")
6. Create a style called Lock.
The following is an example of how this works:
1. The user called frs_qa logs in to the system and opens incident 11010.
2. The user clicks the Lock button in the toolbar. This button can be placed in the form if needed.
3. The user called spandian logs into the system. For testing purposes, he uses a different browser.
4. The user called spandian opens the same incident that is locked by the user called frs_qa. See the figure below.
5. The user called frs_qa saves the record.
The system automatically unlocks the record because the same user who locked it, is now working on it.
The system informs all other users that the record is already open.
To prevent the system from saving the second record, use the following validation rule:
$(AA_LockedBy == CurrentLoginID())
After implementing the above rule, the user who locked the record can save it, while all other users get the following message:
- You can also create an unlock quick action that can allow admins/managers to unlock a record. This quick action sets the lock and locked by fields to false and null respectively.
- You can build a workflow that can run for each hour that gets any record locked for more than 1 hour (or other specified time) and unlock it.