通过保存搜索获取NetSuite中客户主要货币的ISO代码

时间:2015-07-14 06:48:35

标签: netsuite

我是保存搜索中使用的NetSuite公式表达式的新手,我正在尝试返回客户记录主货币的ISO代码。

尝试{currency.symbol}。但它抛出无效的字段错误

2 个答案:

答案 0 :(得分:2)

你有点软。货币没有正确加入客户,所以你能得到的就是货币的名称。

据我所知,没有干净的方法可以将符号转换为已保存的搜索结果。最好的方法是使用case语句从货币到货币符号的非存储公式字段。

如果您只需要这个值,可以在搜索中添加这样的公式:

decode({currency},'USA','USD', 'Euro','EUR','RMB', 'CNY', {currency})

这利用了这样一个事实:对于NS中的多种货币,名称是符号(例如AUD,CAD)。

要获取帐户中的货币及其映射列表,请在控制台窗口中运行以下内容:

var currSymbs = nlapiSearchRecord('currency', null, null,
                           [new nlobjSearchColumn('name'),
                            new nlobjSearchColumn('symbol')
                            ]);
currSymbs.forEach(function(c){
   console.log(c.getId() +': '+c.getValue('name') +' is '+  c.getValue('symbol'));
});

// or even create the decode statement with the script and keep it as a bookmarklet:

console.log("decode({currency},"+currSymbs.map(function(c){
    return "'"+c.getValue('name') +"','"+ c.getValue('symbol')+"'";}).
  join(',') +","+"'not mapped')");

答案 1 :(得分:0)

如果没有公式可以得到字段a,请先查看。某些字段在报告中不可用,但在内部api上。