Thursday, 12 May 2016

Copy the address from one customer to others customers

public void mergeDeliveryAddresses(CustAccount  custAccount,
                                   CustAccount  retCustAccount)
{
    CustTable custTable;
    DirParty dirParty;
    DirPartyPostalAddressView PostalAddress, PostalAddressDest;
    ;

    custTable = CustTable::find(custAccount);

    while select PostalAddress
        where PostalAddress.Party == CustTable.Party
    {
        buf2Buf(PostalAddress, PostalAddressDest);
        PostalAddressDest.Party = CustTable::find(retCustAccount).Party;
        PostalAddressDest.IsPrimary = NoYes::No;       
        PostalAddressDest.LocationName =  PostalAddress.LocationName;
        dirParty = DirParty::constructFromCommon(custTable);
        dirParty.createOrUpdatePostalAddress(PostalAddressDest);

    }


}

No comments:

Post a Comment