[英]How to get customer aging fields from a Netsuite restlet
我遇到了通過Restlet獲取客戶記錄老化信息的問題。 特別是我希望從給定客戶的Customer表單中獲取aging,aging1,aging2,aging3和aging4字段。
在UI中,這些值可以在“財務”部分下的客戶表單中找到,如下所示:
Current 1-30 Days 31-60 Days 61-90 Days Over 90 Days
1200.00 800.00 720.37 423.23 42.00
我的Restlet代碼看起來像這樣:
…
cols[6] = new nlobjSearchColumn('aging');
var result = nlapiSearchRecord(data.record_type, null, filter, cols);
return result;
它適用於其他領域,如“平衡”,但當我包含“老化”字段並運行我的GET時,我看到此錯誤:
"error": {
"code": "SSS_INVALID_SRCH_COL",
"message": "An nlobjSearchColumn contains an invalid column, or is not in proper syntax: aging."
}
顯然我沒有做對的事情。 這些領域在某種程度上是特殊的嗎? 如何檢索這些值?
據我所知,沒有一個名為“老化”的客戶搜索專欄。 這是無效搜索列錯誤的原因。
這些字段也可能不會暴露給搜索或套件,這就是您收到錯誤的原因。
我實際上聯系過Netsuite並且之前的評論是正確的,那些字段沒有公開,所以我根本無法使用它們。
目前有一個增強請求#238854來公開這些字段。
足夠簡單,可以添加到套件上下文中。 例如
var aging = nlapiSearchRecord('invoice', null, [
new nlobjSearchFilter('daysoverdue', null, 'greaterthan', 0),
new nlobjSearchFilter('mainline', null, 'is', 'T'),
new nlobjSearchFilter('amountremaining', null, 'greaterthan', 0)
//for your RESTLet maybe you need this: , new nlobjSearchFilter('entity', null, 'is', data.customer_id)
], [
new nlobjSearchColumn('entity', null, 'group'),
new nlobjSearchColumn('formulanumeric', null, 'sum').setFormula('case when {daysoverdue} < 31 then {amountremaining} else 0 end'),
new nlobjSearchColumn('formulanumeric', null, 'sum').setFormula('case when {daysoverdue} between 31 and 60 then {amountremaining} else 0 end'),
new nlobjSearchColumn('formulanumeric', null, 'sum').setFormula('case when {daysoverdue} between 61 and 90 then {amountremaining} else 0 end'),
new nlobjSearchColumn('formulanumeric', null, 'sum').setFormula('case when {daysoverdue} > 90 then {amountremaining} else 0 end')
]);
aging.forEach(function (inv) {
var cols = inv.getAllColumns();
console.log(inv.getText('entity', null, 'group') +
' 0-30: ' + inv.getValue(cols[1]) +
' 31-60: ' + inv.getValue(cols[2]) +
' 61-90: ' + inv.getValue(cols[3]) +
' > 90: ' + inv.getValue(cols[4]));
});
只是一個關於此的后續注釋:經過近三年的時間,Netsuite仍然沒有對該增強請求采取行動,即使它已經被投票了30次。 此外,上述解決方案產生的數字通常(但並非總是)與Netsuite顯示的數字一致。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.