In this example I will be showing you how to get a customer multiple addresses like delivery, invoices, business etc using the below code.
Here, I'm inserting the data in my contract class to use in my API classes. Pleases change it according to your requirement.
dirParty = DirPartyTable::findRec(custTable.Party);
while select * from logisticsPostalAddress
exists join * from dirPartyLocation
where logisticsPostalAddress.Location == dirPartyLocation.Location
&& dirParty.RecId==dirPartyLocation.Party
&& dirPartyLocation.IsPostalAddress == NoYes::Yes
{
LogisticsLocationRoleType logisticsLocationRoleType;
select RecId from logisticsLocation index hint
LogisticsLocationIdx where logisticsLocation.RecId == logisticsPostalAddress.Location;
dirPartyLocation = DirPartyLocation::findByPartyLocation(dirParty.RecId, logisticsLocation.RecId);
select * from dirPartyLocationRole where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId;
select * from logisticsLocationRole where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole;
logisticsLocationRoleType = logisticsLocationRole.Type;
AddressContract.parmAddressCity(logisticsPostalAddress.City);
AddressContract.parmAddressCountryRegionId(logisticsPostalAddress.CountryRegionId);
AddressContract.parmAddressDescription(logisticsLocation.Description);
AddressContract.parmAddressState(logisticsPostalAddress.State);
AddressContract.parmAddressStreet(logisticsPostalAddress.Street);
AddressContract.parmAddressType(enum2Str(logisticsLocationRoleType));
AddressContract.parmAddressZipCode(logisticsPostalAddress.ZipCode);
AddressContract.parmIsPrimary(dirPartyLocation.IsPrimary);
AddressContract.parmPurpose();
addressList.addEnd(AddressContract);
}
Solution 2
static void RetrieveCustomerAddressBasedOnRole(Args _args)
{
CustTable custTable;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
DirPartyLocationRole dirPartyLocationRole;
LogisticsLocation logisticsLocation;
LogisticsLocationRole logisticsLocationRole;
LogisticsPostalAddress logisticsPostalAddress;
while select custTable
where custTable.AccountNum == /* YOUR ACCOUNT */
join dirPartyTable
where dirPartyTable.RecId == custTable.Party
join dirPartyLocation
where dirPartyLocation.Party == custTable.Party
join dirPartyLocationRole
where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
join logisticsLocationRole
where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole
&& logisticsLocationRole.Type == /* YOUR ROLE - LogisticsLocationRoleType::Delivery*/
join logisticsLocation
where logisticsLocation.RecId == dirPartyLocation.Location
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
{
info(strFmt("%1", logisticsPostalAddress.Address));
}
}
Here, I'm inserting the data in my contract class to use in my API classes. Pleases change it according to your requirement.
dirParty = DirPartyTable::findRec(custTable.Party);
while select * from logisticsPostalAddress
exists join * from dirPartyLocation
where logisticsPostalAddress.Location == dirPartyLocation.Location
&& dirParty.RecId==dirPartyLocation.Party
&& dirPartyLocation.IsPostalAddress == NoYes::Yes
{
LogisticsLocationRoleType logisticsLocationRoleType;
select RecId from logisticsLocation index hint
LogisticsLocationIdx where logisticsLocation.RecId == logisticsPostalAddress.Location;
dirPartyLocation = DirPartyLocation::findByPartyLocation(dirParty.RecId, logisticsLocation.RecId);
select * from dirPartyLocationRole where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId;
select * from logisticsLocationRole where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole;
logisticsLocationRoleType = logisticsLocationRole.Type;
AddressContract.parmAddressCity(logisticsPostalAddress.City);
AddressContract.parmAddressCountryRegionId(logisticsPostalAddress.CountryRegionId);
AddressContract.parmAddressDescription(logisticsLocation.Description);
AddressContract.parmAddressState(logisticsPostalAddress.State);
AddressContract.parmAddressStreet(logisticsPostalAddress.Street);
AddressContract.parmAddressType(enum2Str(logisticsLocationRoleType));
AddressContract.parmAddressZipCode(logisticsPostalAddress.ZipCode);
AddressContract.parmIsPrimary(dirPartyLocation.IsPrimary);
AddressContract.parmPurpose();
addressList.addEnd(AddressContract);
}
Solution 2
static void RetrieveCustomerAddressBasedOnRole(Args _args)
{
CustTable custTable;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
DirPartyLocationRole dirPartyLocationRole;
LogisticsLocation logisticsLocation;
LogisticsLocationRole logisticsLocationRole;
LogisticsPostalAddress logisticsPostalAddress;
while select custTable
where custTable.AccountNum == /* YOUR ACCOUNT */
join dirPartyTable
where dirPartyTable.RecId == custTable.Party
join dirPartyLocation
where dirPartyLocation.Party == custTable.Party
join dirPartyLocationRole
where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
join logisticsLocationRole
where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole
&& logisticsLocationRole.Type == /* YOUR ROLE - LogisticsLocationRoleType::Delivery*/
join logisticsLocation
where logisticsLocation.RecId == dirPartyLocation.Location
join logisticsPostalAddress
where logisticsPostalAddress.Location == logisticsLocation.RecId
{
info(strFmt("%1", logisticsPostalAddress.Address));
}
}
I read that Post and got it fine and informative. Please share more like that...
ReplyDeleteon the site pozyczki-24.pl
Medizinische Fußpflege Klagenfurt offers foot care services that go beyond cosmetics to focus on health and healing.
ReplyDeletehttps://www.waxbar.at/pedik%C3%BCre-klagenfurt