2017-09-12 25 views
1

是否有適當的方式來獲取Netsuite記錄中的所有內部ID列表?如何獲得netsuite中的內部ID列表

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

我可以使用json字符串獲得大部分id,但我正在尋找一個合適的方法。它打印所有數據,包括內部ID。有沒有Api或其他方式?

回答

3

getAllFields()函數將返回給定記錄的所有字段名稱的標準和自定義數組。

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

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

好。它正在工作。感謝您的幫助 –

4

我實際上開發了一個Chrome擴展,它在方便的彈出窗口中顯示這些信息。

enter image description here

我跑進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/

+1

這個插件看起來不錯。 –

+0

非常漂亮的插件。感謝您創建並共享它。 – W3BGUY

+0

太棒了!謝謝! –