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.
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.
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.
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.
Thanks all. Thanks for the ideas.
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.