[英]How to set date for RESTlet in netsuite with Suitescript 2.0
[英]How to set time in Netsuite using suitescript 2.0?
我可以为 UI/API 的timeofday类型字段设置时间。
我可以使用 UI 中的冒号(:) 分隔符将时间类型字段INITIAL TIME BUDGET的时间设置为16:55 。
我无法使用套件脚本为该字段设置时间,如下所示,
function load(recordType, id) {
return record.load({
type: recordType,
id: id
});
}
var recordType = "task"
var id = "123"
var objectRecord = load(recordType, id);
objectRecord.setValue("estimatedtime", "16:55");
var updatedId = objectRecord.save({});
我收到这个错误
You have entered an Invalid Field Value 16:55 for the following field: estimatedtime
我尝试了以下情况,
"16:55" - Invalid Field Value
16:55 - UNEXPECTED_ERROR
16.55 - No error, but set as "estimatedtime":"16:33"
如何为时间类型字段设置时间?
您需要创建一个 Date 对象。 例如,假设您通过了“13:00”,您需要执行以下操作:
dateStr = "13:00";
d = new Date();
dateParts = dateStr.split(":");
d.setHours(+dateParts[0]);
d.setMinutes(+dateParts[1]);
进而:
objectRecord.setValue("estimatedtime", d);
您只需设置小时值。 格式必须为 24 小时。
objectRecord.setValue("估计时间", 23);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.