Hi all,

Hopefully I'm posting in the right place and will make some sort of sense......my knowledge of Javascript is incredibly basic to say the least.

We use Netsuite OpenAir for our project management and they have recently introduced the option of scripting. It uses Javascript language but seemingly mixed with their own terminology.

I'm trying to write some script which will take two numerical fields and auto-populate another field based on a simple sum calculation of those two fields.

I'm getting nowhere fast and was wondering if anyone can suggest anything...............



function projval () {

var savedrecord = NSOA.form.getNewRecord('custom_217'); //get the current record so we can grab its internal id
var project = new NSOA.record.oaProject(); //I used a project record for this example
project.id = savedrecord.id; //set the object id to the saved record internal id
var CustomField1 = NSOA.form.getValue('custom_49__c'); //custom field name with a suffix of 2 underscores and 'c'
var CustomField2 = NSOA.form.getValue('custom_39__c');
var ResultField = 0; //don't know if this is required but I use it to declare a field as numeric
ResultField = CustomField1 * CustomField2;
project.custom_217__c = ResultField;
var attributes = {
name : 'ResultField',
value : 'custom_217'
};
var results = NSOA.wsapi.modify([attributes],[project]);
}