Suitescript - 如何知道子记录中的字段ID - 库存转移
Suitescript - How to know the fields ID in sub record - Inventory transfer
我正在尝试创建一个可以创建 bin 传输的 restlet。
我的代码快完成了,我也可以创建订单项字段了。
我唯一不能做的就是填写库存详细信息,因为我不知道子记录中的字段。如何检查子记录行项目列中的字段 ID?
define([ 'N/record', 'N/search'], function(r, s) {
function onSendRequst(context)
{
var rec = r.create({
type: context.recordtype,
isDynamic: true
});
rec.setValue( 'location', context.from_location_id );
rec.setValue( 'transferlocation', context.to_location_id );
rec.setValue( 'memo', context.memo );
for( var i = 0; i < context.inventory.length; i++)
{
var inv = context.inventory;
// Create sublist Record
rec.selectNewLine({
sublistId: 'inventory',
line: i+1
});
rec.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'item',
value: inv[i].item_ndc
});
rec.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'adjustqtyby',
value: inv[i].qty
});
rec.commitLine({
sublistId: 'inventory'
});
// **CREATE A SUB RECORD**
var itemInventorySubrecord = r.getSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail',
line: x
});
}
var recordId = rec.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
return recordId;
}
return {
post: onSendRequst
}
});
您可以在记录浏览器中的“库存详细信息”条目下找到库存详细信息的字段 ID。子记录在 SuiteScript 记录浏览器中可用,就像常规记录一样。
我正在尝试创建一个可以创建 bin 传输的 restlet。 我的代码快完成了,我也可以创建订单项字段了。
我唯一不能做的就是填写库存详细信息,因为我不知道子记录中的字段。如何检查子记录行项目列中的字段 ID?
define([ 'N/record', 'N/search'], function(r, s) {
function onSendRequst(context)
{
var rec = r.create({
type: context.recordtype,
isDynamic: true
});
rec.setValue( 'location', context.from_location_id );
rec.setValue( 'transferlocation', context.to_location_id );
rec.setValue( 'memo', context.memo );
for( var i = 0; i < context.inventory.length; i++)
{
var inv = context.inventory;
// Create sublist Record
rec.selectNewLine({
sublistId: 'inventory',
line: i+1
});
rec.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'item',
value: inv[i].item_ndc
});
rec.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'adjustqtyby',
value: inv[i].qty
});
rec.commitLine({
sublistId: 'inventory'
});
// **CREATE A SUB RECORD**
var itemInventorySubrecord = r.getSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail',
line: x
});
}
var recordId = rec.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
return recordId;
}
return {
post: onSendRequst
}
});
您可以在记录浏览器中的“库存详细信息”条目下找到库存详细信息的字段 ID。子记录在 SuiteScript 记录浏览器中可用,就像常规记录一样。