In this blog, I will discuss how we can get the contact person name and contact number of the purchase order delivery address located in the line details tab of the PurchTable form.
Source Code:
public static void main(Args _args)
{
LogisticsElectronicAddress electronicAddress;
PurchTable purchTable;
LogisticsLocation logisticsLocation, logisticsLocationParent;
purchTable = PurchTable::find("PurchId");
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));
}