x++ code to get country region id based on legal entity
static void test (Args _args){
CompanyInfo companyInfo;
DirPartyTable dirPartyTable;
LogisticsLocation logisticsLocation;
LogisticsEntityPostalAddressView logisticsEntityPostalAddressView;
;
companyInfo = CompanyInfo::find();
dirPartyTable = DirPartyTable::find(companyInfo.PartyNumber);
select firstonly IsPostalAddress,Recid,LocationId from logisticsLocation
where logisticsLocation.RecId == dirPartyTable.PrimaryAddressLocation
&& logisticsLocation.IsPostalAddress == NoYes::Yes ;
info(strFmt(" location id %1 ",logisticsLocation.LocationId));
select firstonly IsPrimary,CountryRegionId,Location from logisticsEntityPostalAddressView
where logisticsEntityPostalAddressView.IsPrimary == NoYes::Yes
&& logisticsEntityPostalAddressView.Location == logisticsLocation.RecId;
info(strFmt("%1 ",logisticsEntityPostalAddressView.CountryRegionId));
}
Comments
Post a Comment