Discussions
Can't update a custom record
Hi,
I’m trying to search for a particular customer record and then update it with some field values.
This occurs after an item record is created and the record is saved.
Please refer to the following code:
function afterSaveBillingRate(type)
{
var newRecord = nlapiGetNewRecord();
var project = newRecord.getFieldValue('custitempr');
var filters = new Array();
filters[0] = new nlobjSearchFilter( 'altname', null, 'equalTo', project, null );
var columns = new Array();
columns[0] = new nlobjSearchColumn( 'custrecordbilling_rate' );
var searchresults = nlapiSearchRecord('projects', null, filters, columns);
if ( type == 'create' )
{
var record = nlapiLoadRecord(searchresults[ 0 ].getRecordType() , searchresults[0].getID() );
record.setFieldValue('custrecordbilling_rate', project);
nlapiSubmitRecord(record);
}
}
I get an unexpected error message: