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

Dynamically setting entire Form security access through Extension in D365FO

/// <summary> /// To check if user can get access to the Parameter form /// </summary> class SAN_ParamFormsAccessCtrl {     prot...