Accesschildrecordcreatedfromasublistontheparent
创始人
2024-07-22 20:01:26
0

从父列表中访问创建的子记录。

子记录是在父记录的子列表中创建的。要访问子记录,可以使用以下步骤:

  1. 获取对父记录的引用。
  2. 获取子列表的子列表ID。
  3. 使用子列表ID创建记录对象。
  4. 使用记录对象访问子记录的字段。

以下示例代码演示了如何访问在父列表中创建的子记录:

/**
* Create a new child record and access its field
*/

//Get the current sales order record
var mySalesOrder = nlapiLoadRecord('salesorder', 1234);

//Get the internal ID of the first item on the Sales Order
var itemId = mySalesOrder.getLineItemValue('item', 'item', 1);

//Create a new Inventory Adjustment record
var adjustment = nlapiCreateRecord('inventoryadjustment');

//Set the subsidiary and location to match the sales order
adjustment.setFieldValue('subsidiary', mySalesOrder.getFieldValue('subsidiary'));
adjustment.setFieldValue('location', mySalesOrder.getFieldValue('location'));

//Add a new line item for the item on the sales order
adjustment.selectNewLineItem('inventory');
adjustment.setCurrentLineItemValue('inventory', 'item', itemId);
adjustment.setCurrentLineItemValue('inventory', 'adjustqtyby', -1);
adjustment.setCurrentLineItemValue('inventory', 'reason', 'Sales Order');
adjustment.commitLineItem('inventory');

//Save the new adjustment record
var adjustmentId = nlapiSubmitRecord(adjustment);

//Load the newly created child record
var adjustmentRecord = nlapiLoadRecord('inventoryadjustment', adjustmentId);

//Access a field on the child record
var quantity = adjustmentRecord.getLineItemValue('inventory', 'adjustqtyby', 1);

//Log the quantity value
nlapiLogExecution('DEBUG', 'Quantity', quantity);

相关内容

热门资讯

避免在粘贴双引号时向VS 20... 在粘贴双引号时向VS 2022添加反斜杠的问题通常是由于编辑器的自动转义功能引起的。为了避免这个问题...
Android Recycle... 要在Android RecyclerView中实现滑动卡片效果,可以按照以下步骤进行操作:首先,在项...
安装apache-beam==... 出现此错误可能是因为用户的Python版本太低,而apache-beam==2.34.0需要更高的P...
omi系统和安卓系统哪个好,揭... OMI系统和安卓系统哪个好?这个问题就像是在问“苹果和橘子哪个更甜”,每个人都有自己的答案。今天,我...
原生ios和安卓系统,原生对比... 亲爱的读者们,你是否曾好奇过,为什么你的iPhone和安卓手机在操作体验上有着天壤之别?今天,就让我...
Android - 无法确定任... 这个错误通常发生在Android项目中,表示编译Debug版本的Java代码时出现了依赖关系问题。下...
Android - NDK 预... 在Android NDK的构建过程中,LOCAL_SRC_FILES只能包含一个项目。如果需要在ND...
Akka生成Actor问题 在Akka框架中,可以使用ActorSystem对象生成Actor。但是,当我们在Actor类中尝试...
Agora-RTC-React... 出现这个错误原因是因为在 React 组件中使用,import AgoraRTC from “ago...
Alertmanager在pr... 首先,在Prometheus配置文件中,确保Alertmanager URL已正确配置。例如:ale...