Thanks Blue,
static void testContactLogic(Args _args)
{
//WHSShipmentTable shipmentTable = WHSShipmentTable::find('USMF-000002');
SalesTable salesTable = SalesTable::find("SO-0000002");
InventLocation inventLocation;
LogisticsEntityPostalAddressView postalAddressView;
LogisticsElectronicAddress electronicAddress;
LogisticsLocation contactLocation;
LogisticsAddressing address;
inventLocation = inventLocation::find(salesTable.InventLocationId);
if (inventLocation)
{
select firstonly postalAddressView
where postalAddressView.Entity == inventLocation.RecId
&& postalAddressView.EntityType == LogisticsLocationEntityType::Warehouse
&& postalAddressView.isPrimary == NoYes::Yes;
if (postalAddressView)
{
address = postalAddressView.Address;
info(address);
select firstOnly electronicAddress where electronicAddress.Type == LogisticsElectronicAddressMethodType::Phone
join contactLocation where contactLocation.ParentLocation == postalAddressView.Location
&& contactLocation.RecId == electronicAddress.Location;
info(strFmt("Primary contact name: %1 Primary contact phone: %2",electronicAddress.Description, electronicAddress.Locator));
}
}
}
It's done which the matching with SalesOrder >> InventLocationId