Hi All,
I am trying to create a customer in AX using AIF service using a console project.I am am able to create a customer but i am unable to create addresses for this customer. I have pasted the sample code below, any help would be really appreciated.i also want to be able to add multiple addresses for a customer.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CreateCustomerInAx1.CreateCustomerInAx;
namespace CreateCustomerInAx1
{
class createCustomerTest
{
static void Main(string[] args)
{
CustomerServiceClient client = new CustomerServiceClient();
CallContext context;
try
{
context = new CallContext();
context.Company = “CEU”;
context.Language = “en-us”;
CreateCustomerInAx.AxdEntity_CustTable[] custTable = new CreateCustomerInAx.AxdEntity_CustTable[1];
CreateCustomerInAx.AxdEntity_CustTable customertemp = new CreateCustomerInAx.AxdEntity_CustTable();
customertemp.AccountNum = “Test_001”;
customertemp.CustGroup = “10”;
custTable[0] = customertemp;
CreateCustomerInAx.AxdEntity_DirPartyPostalAddressView[] address = new AxdEntity_DirPartyPostalAddressView[1];
address[0].Address = “test address”;
address[0].City = “test”;
address[0].CountryRegionId = “USA”;
address[0].County = “P county”;
address[0].State = “WA”;
address[0].Street = “werwer”;
address[0].District = 12;
address[0].IsPrimary = CreateCustomerInAx.AxdExtType_LogisticsIsPrimaryAddress.Yes;
address[0].LocationId = “adfas”;
address[0].ZipCode = “1782783”;
CreateCustomerInAx.AxdEntity_DirParty_DirPartyTable[] dirParty = new AxdEntity_DirParty_DirPartyTable[1];
dirParty[0].DirPartyPostalAddressView = address;
client.create(context, custTable);
Console.WriteLine(“Customer created”);
}
catch (Exception ex1)
{
Console.WriteLine(ex1.ToString());
}
}
}
}