Hello everyone,
In our day to day life we(Developers) always come across address requirements very frequently, so today's post is related to it.
Fetching customer/Vendor address based on purpose.
public static void
customerInvoiceAddresslookup(FormStringControl _control,
DirPartyRecId _party)
{
query query;
QueryBuildDataSource qbds;
SysTableLookup sysTableLookup;
LogisticsPostalAddress address = null;
DirPartyLocation partyLocation;
DirPartyLocationRole partyLocationRole;
LogisticsLocationRole locationRole;
query = new Query();
sysTableLookup =
SysTableLookup::newParameters(tableNum(LogisticsPostalAddress),
_control);
qbds = query.addDataSource(tableNum(LogisticsPostalAddress));
while
select address
exists join
partyLocation
where partyLocation.Location ==
address.Location
&& partyLocation.Party == _party
&& partyLocation.IsPostalAddress == NoYes::Yes
exists join
partyLocationRole
where
partyLocationRole.PartyLocation == partyLocation.RecId
exists join
locationRole
where locationRole.RecId ==
partyLocationRole.LocationRole
&& locationRole.Type == LogisticsLocationRoleType::Invoice
{
qbds.addRange(fieldNum(LogisticsPostalAddress, location)).value(queryValue(address.location));
}
sysTableLookup.addLookupfield(fieldNum(LogisticsPostalAddress, Address));
sysTableLookup.addLookupfield(fieldNum(LogisticsPostalAddress, Location));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Proud to be a DAX Developer :-)
No comments:
Post a Comment