Can I lock a record that is being edited, and restrict more than one user from editing the same record at the same time?

Can I lock a record that is being edited, and restrict more than one user from editing the same record at the same time?

Yes, with Deluge Scripting you can lock a record that is being edited as described in the steps given below:

1.  Create a Form, for example, with name "LockedID"  with a number field to store the ID number of the record being edited in 'Form X". 

2. In the on edit -> on load success of "Form X", add script as shown in the format below. 

The script checks if a record with the current ID exists in LockedID form. If exists, hide all the fields in the form and display the message that the record is in use, if not, the record ID will be added to the LockedID form.

Here, input.plain field refers to a "Add Notes" field type to display the required message. 

Copy code
  1. if (count(LockedID[Number_Field == input.ID])  ==  1)
  2. {
  3.     hide Email_ID;
  4.     hide Name;
  5.     input.plain = "This record is in use. Please try after sometime";
  6. }
  7. else
  8. {
  9.     insert into LockedID
  10.     [
  11.         Added_User = zoho.loginuser
  12.         Number_Field = input.ID
  13.     ]
  14. }

3. In the on edit -> on success of "Form X", add script as shown in the format below, to delete the record from LockedID form.

Copy code
  1. delete from LockedID[ Number_Field == input.ID ];

Note:

Please note that the on edit -> on success script will be executed only when the record is updated on click on the "Update" button.  If the user, clicks on "Cancel" or "Close" button of the Edit dialog, the script will not be executed and hence the recordID which is locked will not be deleted. 

A work around for the above limitation is to run a custom schedule periodically on the LockedID form that will compare the Added_Time of the records with the current time and delete entries that are listed form than a specific period, say 5 to 10 min.
    • Related Articles

    • Can I lock a record that is being edited, and restrict more than one user from editing the same record at the same time?

      Yes, with Deluge Scripting you can lock a record that is being edited as described in the steps given below: 1.  Create a Form, for example, with name "LockedID"  with a number field to store the ID number of the record being edited in 'Form X".  ...
    • Job Lock

      Beta Feature  Job Lock is not enabled for all users. If you’d like to try it out, please email our support team for beta access.  Job lock allows you to restrict users from editing the entire job or specific fields of the job. Using job, lock you ...
    • Editing Drafts

      Editing your Drafts Here are some points to note when you're managing drafts: Only users with publishing permissions can edit Drafts. Admins on Zoho Social have permissions to schedule and publish posts by default. To edit your drafts, follow these ...
    • Editing Drafts

      Editing your Drafts Here are some points to note when you're managing drafts: Only users with publishing permissions can edit Drafts. Admins on Zoho Social have permissions to schedule and publish posts by default. To edit your drafts, follow these ...
    • Editing Criteria Patterns in Reports

      Edit Criteria Patterns Criteria Pattern Editor in the report help you to define advanced filters using simple logic like and / or. Note You can specify a maximum of 25 criteria in a report. To edit criteria patterns Click the Reports tab. From the ...