How to update vendor addresses in Dynamics AX

How to update vendor addresses in Dynamics AX 2009

Here is trick of X++ by which we can update the address for a vendor in Dynamics ax 2009,  below job is the possible answer and may helps.


static void UpdateVendAddressType(Args _args)
{
VendTable          vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable     dirPartyTab;
Address              addTab;
;
ttsbegin;
while select vendTab join dirPartyTab join forupdate addTab
                                                          where vendTab.PartyId        == dirPartyTab.PartyId
                                                             && addTab.AddrTableId == dirPartyTab.TableId
                                                            && addTab.AddrRecId     == dirPartyTab.RecId
{
      if(addTab.Name == ‘Birincil Adres’)
     {
        addTab.type = AddressType::Payment;
         addTab.update();
     }
}
ttscommit;
}

- Harry

Comments

Popular posts from this blog

Connecting to Databases through X++ PART -I

X++ code for document attachment

Multiple Tables In Query