6 Replies Latest reply on Mar 9, 2017 1:10 PM by philmodjunk

    How to lock fields except during data entry?

    xxx202xxx

      I have a Service MGMT layout in which all fields are lock except for those fields that are editable.  Is there a way (in a script) to unlock a field, enter data, the lock the field again?

        • 1. Re: How to lock fields except during data entry?
          planteg

          Hi xxx202xxx ,

           

          it's not possible as you described it, these parameters can't be changed from a script.

           

          But there is way to achieve your goal by switching to a layout where the field is not locked and then go back to the actual layout. It's so fast the user will not notice.

          • 2. Re: How to lock fields except during data entry?
            DavidJondreau

            There's a few ways to simulate this.

             

            You can use two copies of each field with a Hide condition. One of each field would be set to allow entry in Browse mode, the other not. Hide the one that allows it when the field is not empty. Hide the other when it is empty.

             

            You can add an OnEntry script trigger. The script checks to see if the field has content and commits the record if it does.

            • 3. Re: How to lock fields except during data entry?
              siplus

              All fields are locked except the editable ? That's normal FM behaviour.

               

              Unlock, enter data, then lock? Lock to what ? To entering data ?

               

              Please explain (again but better) what you really want to achieve.

              • 4. Re: How to lock fields except during data entry?
                philmodjunk

                If you are using access permissions to control access to the record, a "full access privileges" enabled script can change a field value to unlock a record locked by Record Level access permissiions.

                 

                But this locks/unlocks the record, not specific fields that are part of a record.

                • 5. Re: How to lock fields except during data entry?
                  xxx202xxx

                  Thanks all. Thanks for the ideas.

                  • 6. Re: How to lock fields except during data entry?
                    philmodjunk

                    Another option is to set up a layout of global fields for editing. To create a new record, go to this layout with all fields empty. The user enters data as needed and clicks a "save" button. The save button's script creates the new record and transfers the data from the globals to corresponding fields in the new record. The global fields need not even be in the same table. To edit an existing record, an "edit" button transfers the data to the global fields and switches to the layout of global fields. The same "save" button and script then works for both new and edited records.

                     

                    Where this can be nice is that the record is not edit locked during data entry and any changes made can be discarded simply by clearing the global fields instead of "saving" them back to a new or existing record. Where this can be not so nice is that the record is not edit locked during data entry. Yes, I just repeated myself, but avoiding the edit lock except during a brief time saving the data from the globals is both a good and bad thing. The negative side si that two users can edit the same record at the same time. Unless you build in your own "Lock management", Who ever "saves last" overwrites the changes made by the other and it's as though those edits never took place.