I've looked all over but can't seem to find how to modify an existing record using Suitescript. Essentially I want to be able to set a field on the record that initiates the script. For example, when I view a custom record, Potential Resource, and save it - it initiates the script (which does happen); but how do I get the information from the record that initiated the script?
Or am I going about this the wrong way?
-- This is what I have in my .js
function getMaxEmployeeNumber(){
var record = nlapiLoadRecord(nlapiGetRecordType()), nlapiGetRecordId());
record.setFieldValue('Last Name', 'Set from script');
}
I don't know if this helps but in NetSuite I've done the following: 1. Created a new User Event script called "Employee Number Creation" 2. Created a script file that has one function in it (above) and added it to my script under the "Scripts" tab. 3. Created a deployment that applies to a custom record (Potential Resource)with a status of "Testing" and an event type of "Edit".