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


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

    DirPartyPostalAddressView       dirPartyPostalAddressView;
    DirParty                        dirParty; 
    VendTable                       vendTable   = VendTable::find("Vendor number");
 
    dirParty = DirParty::constructFromCommon(vendTable);
    select dirPartyPostalAddressView where dirPartyPostalAddressView.Party == vendTable.Party  && dirPartyPostalAddressView.IsPrimary == true;
    dirPartyPostalAddressView.CountryRegionId   = "Jor";
    dirPartyPostalAddressView.ZipCode           = "11";
    dirPartyPostalAddressView.Street            = "";
    dirPartyPostalAddressView.City              = "Amman";
    dirPartyPostalAddressView.DistrictName      = "";
    dirPartyPostalAddressView.State             = "";
    dirPartyPostalAddressView.County            = "";
    dirPartyPostalAddressView.IsPrimary         = true;
    dirPartyPostalAddressView.Party             = vendTable.Party;

    dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView); 

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