Create customer in AX using AIF services

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());

}

}

}

}

What exactly is the problem? Did you get any errors?

No I got no errors, but i couldnt see address created in AX for this customer, i verified the tables in the background but data is not getting populated in any of the tables.

I wanted to know if this is the right way of doing it,or should i insert in address tables explicitly.

Please advice.

Don’t you even see any warnings in System administration > Periodic > Services and Application Integration Framework > Exceptions? You usually can see validation warnings that prevented something from saving.