Pat*_*ane 2 javascript oracle netsuite suitescript
我试图在用户打开采购订单时修改它。这似乎是一个非常简单的例子,但似乎不起作用。在 GUI 中我没有看到“测试”备忘录。在脚本调试中,备注字段为空。
由于调试,我知道脚本正在运行。
/**
* Update Drop Ship PO with route Information
*
* @author Patrick
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/search', 'N/record'],
function(search, record) {
function beforeLoad(context) {
var newRecord = context.newRecord;
newRecord.setValue({fieldId: 'memo', value: 'this is a test'});
log.debug({title: 'memo', details: newRecord.getValue({fieldId: 'memo'})});
return true;
}
return {
beforeLoad: beforeLoad
};
});
Run Code Online (Sandbox Code Playgroud)
我假设它与我可以修改的记录有关,但我一生都无法在文档中找到有效的示例。任何帮助将不胜感激。
您无法修改 中现有记录的字段beforeLoad;有关详细信息,请参阅帮助页面beforeLoad。这是限制的一个片段beforeLoad:
第二个要点与您的问题相关。
小智 5
newRecord.setValue在 beforeLoad 中不起作用。newRecord.submitFields如果你像下面这样使用那就更好了
record.submitFields({
id: newRecord.id,
type: newRecord.type,
values: {'memo': 'this is a test'}
});
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你!!
| 归档时间: |
|
| 查看次数: |
4133 次 |
| 最近记录: |