AX2009 : How to modify all address of a customer through code

Hi friends ,

I want to modify all address (primary, non primary) of customers through code.

that mean with a customer account , i have to loop through all addresses linked to that customer account.

how to do this?

I found the solution:

it will retrive all address associated with customer

DirPartyAddressRelationshipMapping addressRelationshipMapping;
DirPartyAddressRelationship partyAddressRelationship;
Address address;
CustTable Custtable;
;
While Select Custtable
While select partyAddressRelationship
where partyAddressRelationship.PartyId == CustTable::find

(Custtable.AccountNum).PartyId && partyAddressRelationship.Shared &&
(partyAddressRelationship.ValidFromDateTime <= DateTimeUtil::getSystemDateTime()) &&
(partyAddressRelationship.ValidToDateTime > DateTimeUtil::getSystemDateTime())
join addressRelationshipMapping
where addressRelationshipMapping.RefCompanyId == address.dataAreaId &&
addressRelationshipMapping.PartyAddressRelationshipRecId ==

partyAddressRelationship.RecId
join address
where //address.Type == _type &&
address.RecId == addressRelationshipMapping.AddressRecId
{
if(Address)
info(Strfmt(’%1’,Address.Street));
}

}