Sunday, March 6, 2011

How to iterate over addresses in the global address book of Vendors/Customers

I'm frequently asked to mass update addresses for vendors or customers during data imports when something isn't imported correctly.  Here is a simple job that I wrote that shows the relationship between the tables, that you can modify to fit your needs.

static void iterateOverAddresses(Args _args)
    VendTable                           vendTable;
    Address                             address;
    DirPartyAddressRelationship         dpar;
    DirPartyAddressRelationshipMapping  dparm;

    while select address
        join dpar
        join dparm
        join vendTable
              vendTable.PartyId         == dpar.PartyId                         &&
              dpar.RecId                == dparm.PartyAddressRelationshipRecId  &&
              dparm.RefCompanyId        == curExt()                             &&
              dparm.AddressRecId        == address.RecId

No comments:

Post a Comment