gpt4 book ai didi

javascript - 如何使用suitescript在netsuite中设置日期/时间字段

转载 作者:行者123 更新时间:2023-12-03 10:02:56 31 4
gpt4 key购买 nike

var curRate = nlapiCreateRecord("customrecord_currency_exchange_rates",{recordmode: 'dynamic'});
serverDt = "09/25/2013 06:00:01 am"
var timezone = compConf.getFieldText('timezone');
curRate.setDateTimeValue('custrecord_effective_date' ,serverDt ,timezone);


nlapiSubmitRecord(curRate);

您好,我尝试设置 custrecord_effective_date 字段,它是日期/时间类型。但是在执行后它给出了下面的错误。
如何设置此字段?

感谢帮助。

INVALID_FLD_VALUE 您为以下字段输入了无效字段值 09/25/2013 06:00:01 am 用于以下字段:custrecord_effective_date

最佳答案

虽然这是一篇旧帖子,并且最初的问题是关于 SuiteScript 1.0,但我遇到了这个页面,寻找与日期/时间字段相同的 INVALID_FLD_VALUE 错误,但在 SuiteScript 2.0 中,并且由于解决方案最终不同,我想分享它对于 future 的读者。

在 SuiteScript 2.0 中,设置日期/时间字段只需要一个 JavaScript 日期对象。以下是提交前用户事件上下文中的示例。

context.newRecord.setValue({
fieldId : 'custrecord_myfield',
value : new Date()
});

关于javascript - 如何使用suitescript在netsuite中设置日期/时间字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31518808/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com