This Lock is triggered when a user loads the record into the browser. The record will have the edit option on the record list view but when a user clicks Edit, the lock will be reapplied when the record is loaded into the browser.
Editing the record via Inline editing edits the record directly and does not load the record into the browser, the lock will not be applied and thus allowing the user to edit the record.
A solution for this is:
(For this example, we will be locking an Item Record)
1. Create a Custom Field that will signify the Record is Locked
- Type: Checkbox
- ID: custitem_lockeditem
2. Create the Sample Script below
var newrec = nlapiGetNewRecord();
var locked = nlapiLookupField(newrec.getRecordType(), newrec.id, 'custitem_lockeditem');
if(locked == 'T')
throw "Locked record!";
3. Create a new user event script. Setup>Customization>Scripts>New>User Event
Enter information needed on the Basic Information:
Name: (script name)
Scripts > Script File: Upload the sample script above
Before Submit Funtion: userEventBeforeSubmit
Deployments > Applies to: Inventory Part
4. Save the Script Record
This will prevent the user from editing the item record on list view and will receive an error "Locked record!"
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Netsuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Netsuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Netsuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Netsuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.