Skip to main content

Posts

Showing posts with the label Find or Update customer primary Address in Ax 2012

Find or Update customer primary Address in Ax 2012

To Find or Update customer primary Address in Ax 2012 you can try following code. Relation between dirpartytable and custtable slightly changed in Ax 2012 so you need to re-learn about this. LogisticsPostalAddress address; custtable = Custtable::find("C00001"); address.Street = "abc"; address.ZipCode = "280003"; address.City = "Mumbai"; addressView.Party = CustTable.Party; addressview.initFromPostalAddress(address); DirParty = DirParty::constructFromPartyRecId(CustTable.Party); roles = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery).RecId]; DirParty.createOrUpdatePostalAddress(addressView,roles) Note: createOrUpdatePostalAddress method is useful for both creating or updating the customer address. if you are providing the existing dirpartyid then it will update the customer address ,in case of new dirpartyid it will create a new address.