Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
Adding Custom records fails
Hi
I am trying to add a custom record using the server suite script.
previousrecord = nlapiGetOldRecord();
currentrecord = nlapiGetNewRecord();
currentId = currentrecord.getId();
previousId = previousrecord.getId();
recordType = currentrecord.getRecordType();
var strError
//Get the value for the Process Steps
var previousVCValue = previousrecord.getFieldValue('custentity_voice_contact');
var currentVCValue = currentrecord.getFieldValue('custentity_voice_contact');
var leadID = currentrecord.getFieldValue('entityid');
strError = 'leadID = ' + leadID ;
if (previousVCValue == 'F' && currentVCValue == 'T')
{
strError = strError + '1' ;
alert(strError);
var custrec = nlapiCreateRecord('customrecord40');
custrec.setFieldValue('custrecord_pr_lead_id', currentrecord.getFieldValue('entityid'))
if ( !record )
{ alert('error'); }
strError = strError + '2' ;
alert(strError);
}
}
It shows me the 1st alert but keep getting