Thursday 12 March 2015

Adding Customer Address through x++ Coding



The Below code used to update or create address for an existing customer


static void BRR_Address(Args _args)
{
        CustTable                                  custTable;
        DirParty                                     DirParty;
        LogisticsPostalAddress             address;
        DirPartyPostalAddressView      addressView;
        LogisticsLocationRole               roles;


        custtable = Custtable::find("1304");

        address.Street     =   "DLF,";
        address.ZipCode    =   "500006";
        address.City       =   "CyberCity,";
        address.State      =   "TG";
        address.CountryRegionId = "IND";

        addressView.Party = custtable.Party;
        addressview.initFromPostalAddress(address);

        DirParty = DirParty::constructFromPartyRecId(CustTable.Party);
        roles = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery);
        DirParty.createOrUpdatePostalAddress(addressView);
}

1 comment:

  1. This is great!

    How can we use this to upload a csv file that have those fields populated. Can it be done to upload multiple contacts for multiple customer accounts?

    ReplyDelete