本文介绍了如何从Netsuite Restlet获取客户老化字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了通过Restlet获取客户记录的老化信息的问题.具体地说,我希望从给定客户的客户"表单中获取老化",老化1",老化2",老化3"和老化4"字段.

I'm running into problems getting aging information for a customer record via a Restlet. Specficially I'm looking to get the aging, aging1, aging2, aging3, and aging4 fields from the Customer form for a given customer.

在用户界面中,这些值可在财务"部分下的客户"表单上找到,如下所示:

In the UI those values are found on the Customer form under the "Financial" section and look something like:

Current    1-30    Days 31-60    Days 61-90 Days    Over 90 Days
1200.00    800.00  720.37        423.23             42.00

我的Restlet代码看起来像这样:

My Restlet code looks something like this:

…
cols[6] = new nlobjSearchColumn('aging');
var result = nlapiSearchRecord(data.record_type, null, filter, cols);
return result;

它可以很好地与其他字段(例如余额")一起使用,但是当我包含老化"字段并运行GET时,我会看到此错误:

It works great with other fields such as "balance", but when I include the "aging" field and run my GET I see this error:

"error": {
        "code": "SSS_INVALID_SRCH_COL",
        "message": "An nlobjSearchColumn contains an invalid column, or is not in proper syntax: aging."
    }

很明显,我没有做正确的事.这些领域在某种程度上特别吗?如何检索这些值?

Clearly I'm not doing something right. Are those fields special in some way? How do I retrieve those values?

推荐答案

易于添加到Suitescript上下文中.例如

Easy enough to add in a suitescript context. 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]));
});

这篇关于如何从Netsuite Restlet获取客户老化字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 18:41