4 Replies Latest reply on May 9, 2017 6:56 AM by philmodjunk

    Conditionally lock a field



      Conditionally lock a field


           Trying to find a way to conditionally lock a certain field so that anyone can enter data into the field when they create the record, but once it is created, only the person who created the record or a users with a certain privilege set can edit the field.  Everyone would still need to be allowed to edit the rest of the fields in that record.

        • 1. Re: Conditionally lock a field

               A field option validation calculation can probably be designed to do that. Script triggers could use the same logic to deny access to the field. But what values in what fields distinguish a record that is newly created from one that is not?

               There are several options you might use. A status field might record the status of the record. An auto-entered timestamp could be used to "lock" all records after they are 5 minutes, 1 hour, 1 day, etc old.

               A validation calculation will allow users to attempt changing the field, but rejects that input if the "lock" calculation does not evaluate as true. Script triggers can prevent access to the field, but must be set on each and every layout and most triggers can be avoided when drag and drop is used to modify the field. Thus, it's not a bad idea to use both methods. The validation rule then becomes your "insurance policy" to make sure that an unauthorized change to the field did not take place while the script triggers make life nicer for the user.

               And if you want to lock the entire record, there's a better option using settings inside Manage | Security, but this locks all fields in the record, not just one.

          • 2. Re: Conditionally lock a field

            This locking the fields of a record if there is for example date input in the certain field would be very useful to me. Question: how do you make this validation / if calculation formula?

            • 3. Re: Conditionally lock a field

              philmodjunk’s answer is great, but one more question: once the field is locked, should those for whom it is locked be able to interact with the data in the field (e.g. copying the value), or can they only view it? If the latter, you may also want to overlay the field with a second instance of itself. You can have Field Entry:Browse checked on one instance and unchecked on the other, plus a hide condition on each instance: for the standard instance, hide if it’s locked; for the non-enterable instance, hide if it’s unlocked. Just don’t use visual hiding as your only validation; the field should still be validated appropriately.

              • 4. Re: Conditionally lock a field

                Define a field that auto-enters the creation Date.


                Then define this validation rule on the field you wish to lock


                ( Get ( CurrentDate ) - CreationDateField ) <= 3


                And users will be allowed to modify the field for records that are up to 3 days old.


                An auto-entered timestamp could be used to set an "edit window" in hours. (Difference of two timestamps will be elapsed time in seconds)

                1 of 1 people found this helpful