Discussions
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