首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在将netsuite销售订单转换为履行时,如何选择要实现的行项目?

在将netsuite销售订单转换为履行时,如何选择要实现的行项目?
EN

Stack Overflow用户
提问于 2021-07-22 19:34:36
回答 2查看 2.2K关注 0票数 3

尝试使用以下方法转换NetSuite销售订单

代码语言:javascript
运行
复制
 var fulfillment = record.transform({
   fromType: record.Type.SALES_ORDER,
   fromId: currentRecord.id,
   toType: record.Type.ITEM_FULFILLMENT,
   isDynamic: true
 });

获取错误"USER_ERROR“、”消息“:”您必须至少为该事务输入一行项。“

实现包含7个行项,但是在fulfillment.save()之后,它返回没有添加到实现中的行项的错误。

是否有一种方法来选择要实现的行?想一想,在查看销售订单时,单击“履行”,然后单击一个复选框,将哪些行项包含在该实现中。

谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-07-22 21:22:48

有一个事务列字段,名为"itemreceive“。这个“item接收”字段等效于在UI中的Item itemreceive页面上找到的“完全”复选框。下面的代码应该可以工作

代码语言:javascript
运行
复制
//transform SO to create a new Item fulfillment
var fulfillment = record.transform({
  fromType: record.Type.SALES_ORDER,
  fromId: currentRecord.id,
  toType: record.Type.ITEM_FULFILLMENT,
  isDynamic: true
});

//get line count of newly created fulfillment
var lineCount = fulfillment.getLineCount({
    sublistId: 'item'
});

//for each line set the "itemreceive" field to true
for (var i = 0; i < lineCount; i++) {
  fulfillment.selectLine({
      sublistId: 'item',
      line: i
  });
  fulfillment.setCurrentSublistValue({
      sublistId: 'item',
      fieldId: 'itemreceive',
      value: true
  });

  //set other relevant sublist fields
  fulfillment.setCurrentSublistValue({
      sublistId: 'item',
      fieldId: 'fieldId',
      value: 'value'
  });
  fulfillment.commitLine({
      sublistId: 'item'
  });
}

//set any other relevant itemreceive fields
itemreceive.setValue({
  filedId: 'fieldId',
  value: 'value'
});

//save the newly created itemreceive
var itemreceiveId = itemreceive.save({
  enableSourcing: true, //optional, defaul is false
  ignoreMandatoryFields: true  //optional, defaul is false
});
票数 2
EN

Stack Overflow用户

发布于 2021-07-22 21:21:46

如果销售订单中有可实现的行,则可能会出现未选中的“履行”复选框。这是通过设置->会计->会计首选项、订单管理选项卡、履行部分中的“默认项到零接收/履行”复选框控制的。

考虑到在您的帐户中的效果,它可能会被检查,因此,在默认情况下,如果您只创建和保存一个项目实现,行将不会得到满足。

通常,在编写实现脚本时,我将迭代行并执行如下操作:

代码语言:javascript
运行
复制
 var shouldFulfill = someLogic();
 itemFulfillment.setSublistValue({sublistId:'item', fieldId:'itemreceive', line:idx, value:shouldFufill});

或者像你的例子中的isDynamic:true

代码语言:javascript
运行
复制
itemFulfillment.setCurrentSublistValue({sublistId:'item', fieldId:'itemreceive', line:idx, value:shouldFufill});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68490597

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档