如何在 netsuite 中获取内部 ID 列表

How to get a list of internal id in netsuite

是否有正确的方法来获取 Netsuite 记录中所有内部 ID 的列表?

var record = nlapiLoadRecord('customer', 1249);
var string = JSON.stringify(record);
nlapiLogExecution('DEBUG', 'string ', string );

我可以使用 json 字符串获取大部分 ID,但我正在寻找合适的方法。它打印所有数据,包括内部 ID。有没有 Api 或其他方式?

getAllFields() 函数将 return 给定记录的所有字段名称(标准和自定义)的数组。

var customer = nlapiLoadRecord('customer', 5069);
var fields = customer.getAllFields();

fields.forEach(function(field) {
  nlapiLogExecution('debug', field);
})

我实际上开发了一个 Chrome 扩展,可以在方便的弹出窗口中显示此信息。

我 运行 遇到了 nlobjRecord 没有正确字符串化的相同问题,我最终做的是手动请求和解析相同的 AJAX 页面 NS 在您调用时在内部使用nlapiLoadRecord()

  var id = nlapiGetRecordId();
  var type = nlapiGetRecordType();
  var url = '/app/common/scripting/nlapihandler.nl';
  var payload = '<nlapiRequest type="nlapiLoadRecord" id="' + id + '" recordType="' + type + '"/>';

  var response = nlapiRequestURL(url, payload);
  nlapiLogExecution('debug', response.getBody());

您可以在 GitHub

上查看完整的源代码

https://github.com/michoelchaikin/netsuite-field-explorer/