简体   繁体   English

SuiteScript:提交之前(使用用户事件脚本设置子列表值)

[英]SuiteScript: before Submit (Set sublist Value using user event script)

I'm able to get values but not able to set sublist values in user event script beforeRecord submit. 我可以获取值,但不能在用户事件脚本中设置beforelist提交之前的子列表值。 Looping through every line item to get the satisfying condition, when it come's to set value, I couldn't. 遍历每个订单项以获得满意的条件,当涉及到设置值时,我做不到。 am I passing wrong value or something? 我传递错误的值或其他东西吗? I'm not even receiving errors. 我什至没有收到错误。

Please view script (edit): 请查看脚本(编辑):

if (context.type == context.UserEventType.EDIT) { var salesOrderRecord = context.oldRecord; var formId = salesOrderRecord.getValue({ fieldId: 'customform' }); if (formId == 150 ) { var recordId = salesOrderRecord.id; var lineCount = salesOrderRecord.getLineCount({ sublistId: 'item' }); for(var i = 0;i < lineCount; i++){ var sublistItemId = salesOrderRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: i }); if (sublistItemId != '' && sublistItemId == 29498) { log.debug('Get Values',sublistItemId); salesOrderRecord.setSublistValue('item','location',i,39); } } }

In a before submit function, context.oldRecord is a reference to the sales order before it was edited by the user. 在之前提交功能中, context.oldRecord是对用户修改销售订单之前的引用。 context.newRecord is a reference to the sales order after it was edited by the user but before it is committed to the database. context.newRecord是销售订单的参考它是由用户编辑之后 它被提交到数据库。

If you need to make changes, you should be updating context.newRecord as this will also include the changes to the record that the user just made and is the record that is going to be committed to the database. 如果需要进行更改,则应该更新context.newRecord因为这还将包括对用户刚刚进行的记录的更改,该更改是将要提交给数据库的记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SuiteScript; 用户事件脚本中的异步HTTP请求 - SuiteScript; Asynchronous HTTP request inside of user event script 与会者子列表用户事件脚本上的发送电子邮件复选框 - Send Email Checkbox on Attendee Sublist user event script 在提交之前设置PHP值 - set PHP value before submit 将用户事件脚本上载到NetSuite(SuiteScript 2.0)时,不存在N / currentRecord模块 - N/currentRecord module does not exist when uploading User Event script to NetSuite (SuiteScript 2.0) 提交前从输入中设置变量值 - Set variable value from input before submit 尝试使用Suitescript访问Netsuite中的子列表 - Trying to access a sublist in Netsuite with suitescript 有没有办法在从同一个子列表中选择下拉值时禁用子列表字段。 SuiteScript 2.0 getSublistField 方法不起作用 - Is there a way to disable a sublist field while choosing dropdown value from the same sublist. SuiteScript 2.0 getSublistField method not working 如何使用SuiteScript创建脚本记录 - How to create A script record using a SuiteScript 单击提交之前使用选定的选项值 - Using selected options value before clicking submit 如何使用suitescript 2.0动态加载/提供netsuite子列表中类型列表/记录的记录? - How to dynamically load/source a record for type list/record in netsuite sublist using suitescript 2.0?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM