Error in sublist set value displaying custom body field
var dnote = result.getValue(result.columns[3]); // from custom body field
sublist.setSublistValue({
id : ‘colnotes’,
line : i,
value : dnote
// the browser gives me an error
//”type”:”error.SuiteScriptError”,”name”:”SSS_MISSING_REQD_ARGUMENT”,”message”:”Sublist.setSublistValue:
//Missing a required argument: options.value”,”stack”:[“createError(N/error)”,
//”onRequest(/SuiteScripts/WorkOrder_Script.js:204)”,”createError(N/error)”],”cause”:{“name”:”SSS_MISSING_REQD_ARGUMENT”,
//”message”:”Sublist.setSublistValue: Missing a required argument: options.value”},”id”:””,”notifyOff”:false,”userFacing”:true}
});
Please look into sublist API: I don’t seem to find a sublist ID, field ID mentioned accurately.
objRecord.setSublistValue({ sublistId: 'item', fieldId: 'item', line: 3, value: true });
options.idis the correct option for the serverWidget.Sublist api. Seems to fail like this on an empty string. Seems like a bug — treating empty string as undefined here. if you believe it is a bug then you could catch this error and in the catch test if you are setting empty string — if you are not then re-throw the error. That way if it is a bug or not and they fix it or not then you’re insulated.