使用记录浏览器中未列出的记录子列表
Work with sublist on record that isn't listed in record browser
我正在尝试处理客户记录中的交易列表。
当我 运行 record.getSublists();
时,子列表显示的 ID 为 finhist
但是,我无法通过调用 record.getSublist('finhist');
使用此子列表我假设这是因为该子列表未在客户记录的 NetSuite 记录浏览器中列出。
过去 有一个使用搜索模块的解决方法。我似乎无法建立另一个搜索来确定我想要的信息,所以我真正的问题是在搜索模块之外是否有一种方法可以处理记录浏览器中未列出的子列表。
如果没有,那么我正在寻找为客户获取给定类型的所有交易。所以所有销售订单或所有发票等
您将使用交易搜索而不是客户搜索来检索此信息。
// 1.0
function transactionsForCustomerByType(customerId, txType) {
var filters = [
["mainline", "is", "T"], "and",
["type", "anyOf", txType], "and",
["entity", "anyOf", customerId]
];
var columns = [ /* Your search columns */ ];
return nlapiSearchRecord("transaction", null, filters, columns) || [];
}
var invoices = transactionsForCustomerByType(1234, "invoice");
// 2.0
// N/search imported as `s`
function transactionsForCustomerByType(customerId, txType) {
var filters = [
["mainline", "is", "T"], "and",
["type", "anyOf", txType], "and",
["entity", "anyOf", customerId]
];
var columns = [ /* Your search columns */ ];
var search = s.create({
"type": s.Type.TRANSACTION,
"filters": filters,
"columns": columns
});
return search.run().getRange({"start": 0, "end": 1000}) || [];
}
var invoices = transactionsForCustomerByType(1234, s.Type.INVOICE);
如果子列表或记录未在记录浏览器中列出,那么它可能无法编写脚本 - 至少不能通过任何官方支持的方法编写。
我正在尝试处理客户记录中的交易列表。
当我 运行 record.getSublists();
时,子列表显示的 ID 为 finhist
但是,我无法通过调用 record.getSublist('finhist');
使用此子列表我假设这是因为该子列表未在客户记录的 NetSuite 记录浏览器中列出。
过去
如果没有,那么我正在寻找为客户获取给定类型的所有交易。所以所有销售订单或所有发票等
您将使用交易搜索而不是客户搜索来检索此信息。
// 1.0
function transactionsForCustomerByType(customerId, txType) {
var filters = [
["mainline", "is", "T"], "and",
["type", "anyOf", txType], "and",
["entity", "anyOf", customerId]
];
var columns = [ /* Your search columns */ ];
return nlapiSearchRecord("transaction", null, filters, columns) || [];
}
var invoices = transactionsForCustomerByType(1234, "invoice");
// 2.0
// N/search imported as `s`
function transactionsForCustomerByType(customerId, txType) {
var filters = [
["mainline", "is", "T"], "and",
["type", "anyOf", txType], "and",
["entity", "anyOf", customerId]
];
var columns = [ /* Your search columns */ ];
var search = s.create({
"type": s.Type.TRANSACTION,
"filters": filters,
"columns": columns
});
return search.run().getRange({"start": 0, "end": 1000}) || [];
}
var invoices = transactionsForCustomerByType(1234, s.Type.INVOICE);
如果子列表或记录未在记录浏览器中列出,那么它可能无法编写脚本 - 至少不能通过任何官方支持的方法编写。