Hi guys is any one facing the issue while creating...
# suitescript
n
Hi guys is any one facing the issue while creating the Expense report in NetSuite. I am getting error while setting date in the line Item. Below is the code and Error. var create_Exp = record.create({ type: record.Type.EXPENSE_REPORT, isDynamic: true }); create_Exp.setValue({ fieldId: 'entity', Value: employee_Id }); for(var b = 0; b<lines.length;b++) { create_Exp.selectNewLine({ sublistId: 'expense' }); create_Exp.setCurrentSublistValue({ sublistId:'expense', fieldId:'expensedate', Value:'8/15/2020' }); create_Exp.setCurrentSublistValue({ sublistId:'expense', fieldId:'category', Value:lines[b].ExpenseCategoryGLCode }); create_Exp.commitLine({ sublistId: 'expense' }); } var exp_Id = create_Exp.save({ enableSourcing: false, ignoreMandatoryFields: false }); {"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"Field must contain a value.","stack":["anonymous(N/serverRecordService)","Map(/SuiteScripts/MR_Employee_Expense_Reports.js:119)","anonymous(N/serverRecordService)"],"cause":{"type":"internal error","code":"INVALID_FLD_VALUE","details":"Field must contain a value.","userEvent":null,"stackTrace":["anonymous(N/serverRecordService)","Map(/SuiteScripts/MR_Employee_Expense_Reports.js:119)","anonymous(N/serverRecordService)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false}
b
Value
is not a parameter for setCurrentSublistValue
🙂 1
you also want to use a Date with a value related methods and a string with text related methods
usually using N/format to generate the string
n
The same error getting while setting Amount as well
b
you can try sharing the code, but you probably need to go though the docs so you get the parameter names correct
w
value != Value
👍 1
n
You are using Value as the parameter when the actual parameter is value.
create_Exp.setCurrentSublistValue({
sublistId:'expense',
fieldId:'category',
~VALUE~ _*value:*_ lines[b].ExpenseCategoryGLCode
});
👍 1
n
Thanks its work