How to update contact in Dynamics AX 2012 Through X++

How to update contact in Dynamics AX 2012 Through X++


    DirPartyContactInfoView         dirPartyContactInfo;
    DirParty                        dirParty;
    LogisticsLocation               location;
    VendTable                       vendTable   = VendTable::find("Vendor number");
    container                       roles;
 
    location = LogisticsLocation::create("Phone", false);
    DirParty::addLocation(vendTable.Party, location.RecId, false, true);

    dirParty = DirParty::constructFromCommon(vendTable);


    dirPartyContactInfo.LocationName                = "Phone";
    dirPartyContactInfo.Location                    = location.RecId;
    dirPartyContactInfo.Locator                     = "1112222";
    dirPartyContactInfo.IsPrimary                   = NoYes::No;
    dirPartyContactInfo.Type                        = LogisticsElectronicAddressMethodType::Phone; 
    dirPartyContactInfo.Party                       = vendTable.Party;
    dirPartyContactInfo.IsPrimary                   = NoYes::Yes;
    roles   = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Business).RecId]; 
    dirParty.createOrUpdateContactInfo(dirPartyContactInfo,roles);

Comments

Popular posts from this blog

How to loop through enum in dynamics ax 2012 using x++

How to read from csv file in Dynamics AX 2012 Through X++

How to Create Transfer Journal in Dynamics AX 2012 Through X++