Friday, 12 April 2019

Getting company address based on the purpose

static void CompanyAddress(Args _args)
{
    CompanyInfo companyInfo;
    LogisticsPostalAddress  postalAddress;
    DirPartyLocation partyLocation;
    LogisticsLocationRole   locationRole;
    DirPartyLocationRole    partyLocationRole;

    LogisticsEntityPostalAddressView postalAddressView;

   while select companyInfo
           where companyInfo.DataArea == curext()
        join partyLocation
            where partyLocation.Party == companyInfo.RecId
        join postalAddress
            where postalAddress.Location == partyLocation.Location
        join partyLocationRole
            where partyLocationRole.PartyLocation == partyLocation.RecId
        join locationRole
           where partyLocationRole.LocationRole == locationRole.RecId
            && locationRole.Name == strFmt("%1",logisticsLocationRoleType::Delivery)
    {
        info(strFmt("Purpose: %1, IsPrimary: %2, Address %3",locationRole.Type, partyLocation.IsPrimary,  postalAddress.Address));
    }

}

No comments:

Post a Comment

Step-by-Step Guide to Restore a SQL BACPAC File - Microsoft dynamics D365 Fin & Ops

 Restore steps for bacpac file in to SQL server - Microsoft dynamics D365 Fin & Ops. Log in to LCS and navigate to the asset library. On...