Hello,
I am trying to create a customer in AX with a postal address using AIF. The problem is AX is throwing following exception
Cannot create a record in ZIP/postal codes (LogisticsAddressZipCode). ZIP/postal code: 66202, USA.
The record already exists.
My service code looks like this:
AXCustomerService.AxdEntity_DirPartyPostalAddressView address = new AXCustomerService.AxdEntity_DirPartyPostalAddressView();
address.LocationName = "Address";
address.Street = _street;
address.City = _city;
address.State = _state;
address.CountryRegionId = _country;
address.ZipCode = _zip;
address.Roles = @"Delivery;Invoice;Marketing";
address.IsPrimary = AXCustomerService.AxdExtType_LogisticsIsPrimaryAddress.Yes;
address.IsPrimarySpecified = true;
AXCustomerService.AxdEntity_DirParty_DirOrganization dpt = new AXCustomerService.AxdEntity_DirParty_DirOrganization();
dpt.Name = "ABC Company";
dpt.DirPartyPostalAddressView = new AXCustomerService.AxdEntity_DirPartyPostalAddressView[1] { address };
AXCustomerService.AxdEntity_CustTable custTable = new AXCustomerService.AxdEntity_CustTable();
custTable.CustGroup = "FBO";
custTable.DirParty = new AXCustomerService.AxdEntity_DirParty_DirPartyTable[1] { dpt };
AXCustomerService.AxdCustomer customer = new AXCustomerService.AxdCustomer();
customer.CustTable = new AXCustomerService.AxdEntity_CustTable[1] { custTable };
AXCustomerService.EntityKey[] keysCustomer = null;
keysCustomer = client.create(context, customer);
when code client.create(context, customer); executes AX throws exception stated in the beginning, my concern is that why AX is even calling insert method on LogisticsAddressZipCode table? it should only be creating a record in DirPartyPostalAddressView.
Any ideas?