RE: How to fetch “Custom” Address from a Multiple Shipping Routes enabled Sales Order?

I have Multiple Shipping Routes enabled Sales Orders and I am not able to fetch the address fields from the item line, when the address is a Custom one which is not saved in the entity record.

Has anyone done this?

Rosse Rookie Asked on October 2, 2019 in SuiteScript.
Add Comment
3 Answers

You can use the iladdrbook sublist to fetch the addresses.

 * Function to get all shipAddresses from a transaction including Custom Addresses
function getMultiShipAddresses () { 
    var multiShipAddresses = []; 
    for (var ilAddrIdx = 1; ilAddrIdx<= nlapiGetLineItemCount(‘iladdrbook’); ilAddrIdx++){
        var shipAddressObj ={};
        shipAddressObj.internalid = nlapiGetLineItemValue(‘iladdrbook’, ‘iladdrinternalid’, ilAddrIdx); 
        shipAddressObj.addr1 = nlapiGetLineItemValue(‘iladdrbook’, ‘iladdrshipaddr1’, ilAddrIdx); = nlapiGetLineItemValue(‘iladdrbook’, ‘iladdrshipcity’, ilAddrIdx); 
        shipAddressObj.state = nlapiGetLineItemValue(‘iladdrbook’, ‘iladdrshipstate’, ilAddrIdx); = nlapiGetLineItemValue(‘iladdrbook’, ‘iladdrshipzip’, ilAddrIdx); = nlapiGetLineItemValue(‘iladdrbook’, ‘iladdrshipcountry’, ilAddrIdx);   
        nlapiLogExecution(‘DEBUG’, ‘getMultiShipAddresses’,
                ‘shipAddressObj.internalid: ‘+shipAddressObj.internalid +
                ‘shipAddressObj.addr1: ‘+shipAddressObj.addr1 +
                ‘ ‘ +
                ‘shipAddressObj.state: ‘+shipAddressObj.state +
                ‘ ‘ +
                ‘ ‘ 
            multiShipAddresses[shipAddressObj.internalid] = shipAddressObj;
    return multiShipAddresses; 
Rookie Answered on October 4, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.