如何从Netsuite restlet获取客户账龄字段

如何从Netsuite restlet获取客户账龄字段,netsuite,Netsuite,我在通过Restlet获取客户记录的老化信息时遇到问题。具体来说,我希望从给定客户的客户表单中获取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代

我在通过Restlet获取客户记录的老化信息时遇到问题。具体来说,我希望从给定客户的客户表单中获取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."
    }

很明显,我做得不对。这些领域在某种程度上是特殊的吗?如何检索这些值?

据我所知,没有名为“老化”的客户搜索栏。这是无效搜索列错误的原因


此外,这些字段可能不会暴露于搜索或suitescript中,这就是您出现错误的原因。

据我回忆,没有称为“老化”的客户搜索栏。这是无效搜索列错误的原因


此外,这些字段可能不会暴露在搜索或suitescript中,这就是您出现错误的原因。

我实际上联系了Netsuite,前面的评论是正确的,这些字段没有暴露,因此我无法使用它们


目前有一个增强请求#238854公开这些字段。

我实际上联系了Netsuite,前面的评论是正确的,这些字段没有公开,因此我无法使用它们


目前有一个增强请求#238854来公开这些字段。

很容易添加到suitescript上下文中。e、 g

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]));
});
var aging=nlapiSearchRecord('invoice',null[
新的nlobjSearchFilter('daysoverdue',null,'greaterthan',0),
新的nlobjSearchFilter('mainline',null,'is','T'),
新的nlobjSearchFilter('AMONTREMAING',null',greaterthan',0)
//对于RESTLet,您可能需要以下内容:,新的nlobjSearchFilter('entity',null',is',data.customer\u id)
], [
新的nlobjSearchColumn('entity',null,'group'),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoverdue}<31然后{amounterMaining}否则0结束时的情况),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoverdue}介于31和60之间时的大小写,然后{amontremain}否则为0 end'),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoverdue}介于61和90之间时的大小写,然后{amontremain}否则为0 end'),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoferdue}>90然后{amounterMaining}否则为0 end'时的情况)
]);
账龄.forEach(功能(库存){
var cols=inv.getAllColumns();
console.log(inv.getText('entity',null,'group'))+
“0-30:”+inv.getValue(列[1])+
“31-60:”+inv.getValue(列[2])+
“61-90:”+inv.getValue(列[3])+
'>90:'+inv.getValue(cols[4]);
});

很容易添加到suitescript上下文中。e、 g

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]));
});
var aging=nlapiSearchRecord('invoice',null[
新的nlobjSearchFilter('daysoverdue',null,'greaterthan',0),
新的nlobjSearchFilter('mainline',null,'is','T'),
新的nlobjSearchFilter('AMONTREMAING',null',greaterthan',0)
//对于RESTLet,您可能需要以下内容:,新的nlobjSearchFilter('entity',null',is',data.customer\u id)
], [
新的nlobjSearchColumn('entity',null,'group'),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoverdue}<31然后{amounterMaining}否则0结束时的情况),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoverdue}介于31和60之间时的大小写,然后{amontremain}否则为0 end'),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoverdue}介于61和90之间时的大小写,然后{amontremain}否则为0 end'),
新的nlobjSearchColumn('formulanumeric',null,'sum').setFormula({daysoferdue}>90然后{amounterMaining}否则为0 end'时的情况)
]);
账龄.forEach(功能(库存){
var cols=inv.getAllColumns();
console.log(inv.getText('entity',null,'group'))+
“0-30:”+inv.getValue(列[1])+
“31-60:”+inv.getValue(列[2])+
“61-90:”+inv.getValue(列[3])+
'>90:'+inv.getValue(cols[4]);
});

这只是一个后续说明:在将近三年之后,Netsuite仍然没有对该增强请求采取行动,尽管它已经被投票30次了。此外,上述解决方案产生的数字通常(但并非总是)与Netsuite显示的数字一致。

只是一个后续说明:近三年后,Netsuite仍然没有对该增强请求采取行动,尽管它已经被投票30次。此外,上述解决方案产生的数字通常(但并非总是)与Netsuite显示的数字一致。

您可以使用Netsuite记录/架构浏览器查看哪些字段可用于编写脚本以及它们的内部ID。正如@RustyShackles所说,这些字段似乎没有暴露出来。再次检查,我相信2016年api已经添加了我已经检查过的内容。不,它不在那里。您可以使用NetSuite记录/架构浏览器查看哪些字段可用于脚本编写,以及它们的内部ID是什么。正如@RustyShackles所说,这些字段似乎没有暴露出来。再次检查,我相信2016年api已经添加了我已经检查过的内容。不,它不在那里。但是,你可以很容易地导出账龄值。请参阅上面的我的帖子。但是,你可以很容易地导出账龄值。请参阅上面的我的帖子。对格式设置感到抱歉。也许这会更具可读性。我把上面的代码放在我的suitescript中,它只返回一个“formulanumeric”列。这就好像实际的列名是“formulanumeric”,它会不断覆盖它。是的,Netsuite对formulaX字段很奇怪。注意我是如何使用列索引作为.getValue()的键的。据我所知,这是唯一可靠的方式,以获得搜索结果时,你h