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}