Showing posts with label Get customer email address based on the purpose. Show all posts
Showing posts with label Get customer email address based on the purpose. Show all posts

Friday, 12 April 2019

Get customer or vendor email address based on the purpose

static void Vend_CustEmailAddressUsingPurpose(Args _args)
{
    VendTable                           vendTable; //if you need customer you can change CustTable.
    DirPartyLocation                    dirPartyLocation;
    LogisticsElectronicAddress          logisticsElectronicAddress;
    LogisticsElectronicAddressRole      logisticsElectronicAddressRole;
    LogisticsLocationRole               logisticsLocationRole;
   
    select firstOnly vendTable
        where vendTable.AccountNum == '‪‪‪US-105';
   
    while select dirPartyLocation
        where dirPartyLocation.party == vendTable.Party
    {
        while select logisticsElectronicAddress
            where logisticsElectronicAddress.Location == dirPartyLocation.Location
                && logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Email
        {
            while select logisticsElectronicAddressRole
                where logisticsElectronicAddressRole.ElectronicAddress == logisticsElectronicAddress.RecId
                join logisticsLocationRole
                where logisticsLocationRole.RecId == logisticsElectronicAddressRole.LocationRole
                && logisticsLocationRole.Name == strFmt("%1",logisticsLocationRoleType::Business)
            {
                info(strFmt("%1 - %2", logisticsElectronicAddress.Locator, logisticsLocationRole.Name));
            }
        }
    }
}

output:

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...