我正在尝试使用 suitescript 在项目任务上创建时间条目记录。但它返回 FEATURE_DISABLED 错误: "type":"error.SuiteScriptError","name":"FEATURE_DISABLED","message":"此帐户中未启用访问此页面所需的功能“时间表”。"," id":"","stack":["匿名(N/serverRecordService)","执行(/SuiteScripts/time_entry_test.js:47)"]
我写了这段代码。执行rec.save()行时抛出错误。我还想知道如何对“持续时间”字段(字段 ID:小时)使用 setValue() 方法。我尝试使用 4:00 和 4:00:00 等值,但它不接受它们。我如何在此字段中输入小时和分钟?
var rec = record.create(
{
type: record.Type.TIME_ENTRY,
isDynamic: true
}
);
rec.setValue({
fieldId: 'employee',
value: 1962,
ignoreFieldChange: true
});
rec.setValue({
fieldId: 'customer',
value: 2069,
ignoreFieldChange: true
});
rec.setValue({
fieldId: 'casetaskevent',
value: 1227,
ignoreFieldChange: true
});
rec.setValue({
fieldId: 'hours',
value: 5,
ignoreFieldChange: true
});
var trackTime = rec.save();
尝试使用以下代码,您需要使用“timebill”,对于持续时间/小时,您需要使用格式为“hh:mm”的字符串,分钟只能是 15 分钟的倍数,NetSuite 会自动舍入如果您输入不同的内容,时间到了。
require(['N/action', 'N/record'], function(action, record) {
var rec = record.create({
type: 'timebill',
isDynamic: true
});
rec.setValue({
fieldId: 'employee',
value: 104
});
rec.setValue({
fieldId: 'location',
value: 312
});
rec.setValue({
fieldId: 'hours',
value: '2:15'
});
//set the rest of your fields
var recordId = rec.save();
});