In this blog, I will discuss how we can get the contact person name and contact number of purchase order delivery address located in the line details tab of PurchTable form.

Source Code:









public static void main(Args _args)
    {
        LogisticsElectronicAddress  electronicAddress;
        PurchTable                  purchTable;
        LogisticsLocation           logisticsLocation, logisticsLocationParent;

        purchTable = PurchTable::find("PurchaseOrderId");
        logisticsLocationParent = LogisticsLocation::find(purchTable.deliveryAddress().Location);

        select ParentLocation, RecId from logisticsLocation where
                logisticsLocation.ParentLocation == logisticsLocationParent.RecId;

        electronicAddress = LogisticsElectronicAddress::findByLocationAndType(logisticsLocation.RecId, LogisticsElectronicAddressMethodType::Phone);

        info(strFmt("Contact number: %1", electronicAddress.Locator));
        info(strFmt("Contact Person : %1", electronicAddress.Description));
    }