Hi guys please find the below code to get the postal addresses of customer based on the Party ID and location role type.
info(strFmt("%1, %2",
logisticsLocation.Description, postalAddress.Address));
The above code is an example for customer address. Similarly we can find it for vendors, employees etc by passing the party id of the corresponding record.
CustTable custTable;
LogisticsPostalAddress
postalAddress;
DirPartyLocation dirPartyLocation;
DirPartyLocationRole dirPartyLocationRole;
LogisticsLocationRole locationRole;
LogisticsLocation logisticsLocation;
;
custTable
= CustTable::find("C-000005");
select
postalAddress
join Description from logisticsLocation
join dirPartyLocation
join dirPartyLocationRole
join locationRole
where
postalAddress.Location == dirPartyLocation.Location
&&
logisticsLocation.RecId == dirPartyLocation.Location
&& dirPartyLocation.RecId == dirPartyLocationRole.PartyLocation
&& dirPartyLocationRole.LocationRole == locationRole.RecId
&&
dirPartyLocation.Party == custTable.Party
&&
locationRole.Type == LogisticsLocationRoleType::Delivery; //(to get delivery address)
The above code is an example for customer address. Similarly we can find it for vendors, employees etc by passing the party id of the corresponding record.
No comments:
Post a Comment