[AX2012] Get Email for Customer / Vendor (with specific roles)

Get Email for Customer / Vendor (with specific roles)

static void KK_Email (Args _args)
{
    DirPartyLocation dirPartyLocation;
    LogisticsElectronicAddress elecAddress;
    LogisticsElectronicAddressRole elecAddressRole;
    LogisticsLocationRole locRole;
    Email   email;
    
    
    while select dirPartyLocation
        where dirPartyLocation.Party == 22565427693
    {
        while select elecAddress
            where elecAddress.Location == dirPartyLocation.Location
            && elecAddress.Type == LogisticsElectronicAddressMethodType::Email
        {
            while select elecAddressRole
                where elecAddressRole.ElectronicAddress == elecAddress.RecId
                join locRole
                where locRole.RecId == elecAddressRole.LocationRole
                && locRole.Name == "Home"
            {
            info(strFmt("%1 - %2", elecAddress.Locator, locRole.Name));
            }
        }
    }
}
    

Comments

Popular posts from this blog

How to Calculate Planned Purchase Order

How to calculate On Hand Inventory Per Day

How to Calculate Purch Totals in purchase order's Totals Form