Thursday, January 21, 2016

update primary Contact Person for customer ax 2012

static void UpdatePrimaryContact(Args _args)
{
    DirPartyTable dirpartyTable;
    LogisticsElectronicAddress  electronicAddress;
    CustTable   custTable;
    DirPartyLocation        dirpartyLocation;
    LogisticsLocation      location;
    ;
    while select custTable
        //where custTable.AccountNum == "30008"
        join dirpartyLocation
         where dirpartyLocation.Party == custTable.Party
        join location where location.RecId == dirpartyLocation.Location
        && location.IsPostalAddress == false
        join electronicAddress
        where electronicAddress.Location == location.RecId
    {
        dirpartyTable.ttsbegin();
        dirpartyTable = DirPartyTable::findRec(custTable.Party,true);
        dirpartyTable.PrimaryContactPhone = electronicAddress.RecId;
        dirpartyTable.update();
        dirpartyTable.ttscommit();
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...