I'm trying to set a value for the sublist 'addressbookaddress'. But the script fail with error. However, I'm able to get the subrecord value.
Error:
Not supported on the current subrecord: CurrentSubrecord.setValue.
Executed code:
/**
*@NApiVersion 2.0
*@NScriptType ClientScript
*/
define(["N/currentRecord"], function(currentRecord){
/*
Copy phone number from vendor to address, when creating a new sublist entry
*/
var lineInit = function(context) {
var record = context.currentRecord;
var sublistId = context.sublistId;
var subrecord = record.getCurrentSublistSubrecord({
sublistId: sublistId,
fieldId: 'addressbookaddress'
});
if (!subrecord) {
return;
}
var address = subrecord.getValue({
fieldId: 'addr1'
});
subrecord.setValue({
fieldId: 'addr1',
value: 'test'
});
return;
}
return {
lineInit: lineInit,
}
});