理解した!将来ここに足を踏み入れる失われた魂のために:
以下は、受注明細レベルでカスタム住所をループして特定の情報を引き出すために使用できる関数です。
うまくいけば、これはある時点で NetSuite のドキュメントに追加されるでしょう。
これは特に状態情報のために行っていたことに注意してください。利用可能な他のフィールドを確認したい場合&xml=T
は、送信された販売注文 URL の末尾に を追加しiladdrbook
、結果の xml 構造で を検索します。これは、実際には広告申込情報のように扱われます。
function getCustomAddressFromLineItem(soLineNum) {
nlapiLogExecution('DEBUG', 'Custom Address', 'Custom Address: Line # ' + soLineNum);
var addressid = nlapiGetLineItemValue('item','shipaddress',soLineNum); // get the id of the custom address
var customAddressesLineCount = nlapiGetLineItemCount('iladdrbook'); // get custom address book count
nlapiLogExecution('debug', 'test', 'addressid: ' + addressid + ' -- linecount: ' + customAddressesLineCount);
for (var i = 1; i <=customAddressesLineCount; i++)
{
var addressinternalid = nlapiGetLineItemValue('iladdrbook','iladdrinternalid',i); // get internal id of custom address book
if (addressinternalid == addressid) // match it with the id of custom address being set
{
var addr = nlapiGetLineItemValue('iladdrbook','iladdrshipaddr1',i);
var customState = nlapiGetLineItemValue('iladdrbook','iladdrshipstate',i); // get your state
nlapiLogExecution('debug', 'test', 'address: ' + addr + ' -- state: ' + customState);
return customState;
}
}
}