Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
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