This document describes how to enable the record locking functionality and how to lock and unlock records.
The record locking functionality allows you to control access on a level between the Data Authority Security and the Field Access Security.
With the record locking functionality, a record can be locked from being edited or deleted in interactive programs and APIs. When a record has been locked options 2='Change' and 4='Delete' are not allowed for any user. The same applies if there is any related option that updates the record. If you try to update or delete a locked record an error message is displayed indicating that the record is locked in the specific program. Automated updates of records, where you have no direct interaction with the record itself, such as batch programs and auto jobs, are exempt from this validation.
Example of situations when it is useful to be able to lock records are when they are connected to an ongoing workflow in ION or a pending e-signature. The functionality could also be used to lock template records that users should not be allowed to change, for example templates for items, suppliers or customers.
Follow these steps to enable the record locking functionality for a program:
With filter 5-'Record lock activated' you can search for programs where the functionality has already been activated.
This table shows examples of programs and APIs where the record locking functionality has been implemented:
|Program ID||Program name||Table||API|
|CRS624||Supplier. Define Purchase Financial||CIDVEN||CRS620MI|
|MMS002||Item. Connect Warehouse||MITBAL||MMS200MI|
|MMS003||Item. Connect Facility||MITFAC||MMS200MI|
|MMS200||Item. Open Toolbox||-||MMS200MI|
The verification process for locked records added in (MMS200) is performed when you go directly from (MMS200) to a detail panel (for example, the E panel) in (MMS001), (MMS002) or (MMS003), and the record locking functionality has been enabled for the applicable program in (CMS005). This applies even if (MMS200) does not exist in (CMS005) and therefore cannot be enabled there.
It is mandatory to specify a reason code for every locked record. The reason codes are defined in 'Reason Codes. Open' (CMS432). They are used as a selection criterion, and also in the information message that informs a user why a record is locked from changes.
This table shows the predefined reason codes and their purpose:
|1='Workflow'||For records that are locked by an ongoing workflow in ION.|
|2='E-signature'||For records that are locked because of a pending e-signature.|
When an exception occurs that requires you to lock a record manually and not as part of an automated process.
For this alternative the user ID of the user who locked the record is automatically specified as the external reference connected to the locked record.
There is no built-in automation for workflows or e-signatures, only recommendations of how the reason codes are to be used.
The predefined codes cannot be changed or deleted, but name and description can be specified in alternate languages in 'Language Handling. Open' (CRS830) by clicking 'Language' in (CMS432).
Reason codes 700 - 999 can be user-defined if more alternatives are required.
The records in (CMS432), CERECD table, can also be managed through API CMS432MI (Reason code interface).
Records that should be locked from being edited or deleted are specified in 'Locked Records. Open' (CMS430). Only one record can exist in (CMS430) with the same table and key string, so a record can only be locked once at a time.
Locked records are unlocked by deleting them from (CMS430), as the number of records may otherwise grow over time. If you only want to unlock a record temporarily, the parameter 'Lock' can be set to 0 and then changed back to 1 again. The related options 20='Lock' and 21='Unlock' can be used for this purpose or it can be done using corresponding API transactions.
This table describes the different fields in (CMS430) and how they are used:
|Table||The field indicates the name of the table where the locked record is stored.|
|Key string||The field indicates several key value pairs (field name and a value) which uniquely identify a record in the specified table. In (CMS430) the key values for a record are automatically converted to a key string in URL encoded format, since this is how the key values are stored in the CELOCK table when creating a new locked record.|
The field indicates the reason why a record is locked and must be specified when creating a locked record.
The following alternatives are predefined:
For alternative 3, the user ID of the person who locked or unlocked the record in the CELOCK table is automatically assigned as the external reference (EXRE).
See Define reason codes for more information.
|External reference||The field indicates the identity of a reference connected to the locked record. For example, a workflow ID of a workflow started in Infor ION or an e-signature number of an e-signature record. The reference could also be the user ID of the user who locked or unlocked the record in (CMS430) if reason code 3-'Manual' was selected.|
The field indicates if a record is locked from being edited or deleted in the applicable program.
0 = Unlocked
|Field / Name||The field indicates the name and description of the key fields, which is displayed according to the primary key for the specified table.|
The field indicates the key value connected to each key field for a record in the specified table. The values must correspond to an existing record in the specified table to create the record in (CMS430).
'Company' (CONO) is set as default to current company for the logged-on user, if applicable for the table.
Guidance of how to specify different type of values:
In (CMS430) manual record locks are specified. For example, to lock template records.
You want to lock a supplier template from being edited or deleted in 'Supplier. Open' (CRS620).
You want to unlock a locked supplier template so it can be edited or deleted.
Locking records is usually done through API in an automated process, for example, a workflow in ION. Steps must then be added to the workflow to lock and unlock the records. The API CMS430MI (Record locking interface) has been created to manage records in (CMS430), for the CELOCK table.
This table shows the transactions available in CMS430MI:
|AddRecordLock||Adds a locked record|
|DltMultiRecLock||Deletes multiple records from table CELOCK|
|DltRecordLock||Deletes a locked record|
|GetRecordLock||Gets data for a locked record|
|LstRecordLock||Lists data for locked records|
|SetLock||Sets a record to locked|
|SetUnlock||Sets a record to unlocked|
|UpdRecordLock||Updates data for a locked record|
Only one record can exist in the CELOCK table with the same table and key string. But if a record is unlocked (BLOC = 0) this record can be taken over by another external reference and reason code, and set to locked with the 'AddRecordLock' transaction.
We recommend that you clear the CELOCK table from obsolete records on a regular basis. The API transaction 'DltMultiRecLock' has been created for this purpose.
These are descriptions of some of the fields in the transaction and how they are used: