AX Customer Document service,
This is the piece of code to create the AX 2009 customer through AIF customer document service.
It creates Customer in customer and address for the same.
AxdCustomer axdCustomer = new AxdCustomer();
CustomerServiceClient CstService = new CustomerServiceClient();
AxdEntity_CustTable tabCustomer = new AxdEntity_CustTable();
AxdEntity_AddressRelationship addressRelation = new AxdEntity_AddressRelationship();
AxdEntity_AddressRelationshipMap addRelationshipMap = new AxdEntity_AddressRelationshipMap();
AxdEntity_CustAddress customerAddress = new AxdEntity_CustAddress();
CstService.ClientCredentials.Windows.ClientCredential.UserName = "domainusername";
CstService.ClientCredentials.Windows.ClientCredential.Password = "password";
CstService.ClientCredentials.Windows.ClientCredential.Domain = "domainname";
axdCustomer.SenderId = "company/entity name";
axdCustomer.CustTable = new AxdEntity_CustTable[] { tabCustomer };
tabCustomer.AccountNum = "TEST11";
tabCustomer.Currency = "USD";
tabCustomer.CustGroup = "DOMESTIC";
tabCustomer.LanguageId = "En-us";
tabCustomer.PartyType = AxdEnum_DirPartyType.Organization;
tabCustomer.CashDisc = "1/2% 10 Days";
//tabCustomer.Name = "TEST11";
//tabCustomer.NameAlias = "TEST11";
tabCustomer.PaymTermId = "Net 30";
tabCustomer.TaxGroup = "TAX-POD";
tabCustomer.AddressRelationship = new AxdEntity_AddressRelationship[] { addressRelation };
addressRelation.IsPrimary = AxdExtType_DirIsPrimaryAddress.Yes;
addressRelation.IsPrimarySpecified = true;
addressRelation.PartyId = "TEST11";
addressRelation.Shared = AxdExtType_DirIsSharedAddress.Yes;
addressRelation.SharedSpecified = true;
addressRelation.AddressRelationshipMap = new AxdEntity_AddressRelationshipMap[] { addRelationshipMap };
addRelationshipMap.CustAddress = new AxdEntity_CustAddress[] { customerAddress };
customerAddress.type = AxdEnum_AddressType.Invoice;
customerAddress.typeSpecified = true;
customerAddress.ZipCode = "YORK";
customerAddress.Phone = "6369";
try
{
EntityKey[] key = CstService.create(axdCustomer);
}
catch (Exception e1)
{
Console.WriteLine("{0} Exception caught.", e1);
}
Try and Enjoy AXingg,,
Thanks,
K. Arunsubramaniam
This is the piece of code to create the AX 2009 customer through AIF customer document service.
It creates Customer in customer and address for the same.
AxdCustomer axdCustomer = new AxdCustomer();
CustomerServiceClient CstService = new CustomerServiceClient();
AxdEntity_CustTable tabCustomer = new AxdEntity_CustTable();
AxdEntity_AddressRelationship addressRelation = new AxdEntity_AddressRelationship();
AxdEntity_AddressRelationshipMap addRelationshipMap = new AxdEntity_AddressRelationshipMap();
AxdEntity_CustAddress customerAddress = new AxdEntity_CustAddress();
CstService.ClientCredentials.Windows.ClientCredential.UserName = "domainusername";
CstService.ClientCredentials.Windows.ClientCredential.Password = "password";
CstService.ClientCredentials.Windows.ClientCredential.Domain = "domainname";
axdCustomer.SenderId = "company/entity name";
axdCustomer.CustTable = new AxdEntity_CustTable[] { tabCustomer };
tabCustomer.AccountNum = "TEST11";
tabCustomer.Currency = "USD";
tabCustomer.CustGroup = "DOMESTIC";
tabCustomer.LanguageId = "En-us";
tabCustomer.PartyType = AxdEnum_DirPartyType.Organization;
tabCustomer.CashDisc = "1/2% 10 Days";
//tabCustomer.Name = "TEST11";
//tabCustomer.NameAlias = "TEST11";
tabCustomer.PaymTermId = "Net 30";
tabCustomer.TaxGroup = "TAX-POD";
tabCustomer.AddressRelationship = new AxdEntity_AddressRelationship[] { addressRelation };
addressRelation.IsPrimary = AxdExtType_DirIsPrimaryAddress.Yes;
addressRelation.IsPrimarySpecified = true;
addressRelation.PartyId = "TEST11";
addressRelation.Shared = AxdExtType_DirIsSharedAddress.Yes;
addressRelation.SharedSpecified = true;
addressRelation.AddressRelationshipMap = new AxdEntity_AddressRelationshipMap[] { addRelationshipMap };
addRelationshipMap.CustAddress = new AxdEntity_CustAddress[] { customerAddress };
customerAddress.type = AxdEnum_AddressType.Invoice;
customerAddress.typeSpecified = true;
customerAddress.ZipCode = "YORK";
customerAddress.Phone = "6369";
try
{
EntityKey[] key = CstService.create(axdCustomer);
}
catch (Exception e1)
{
Console.WriteLine("{0} Exception caught.", e1);
}
Try and Enjoy AXingg,,
Thanks,
K. Arunsubramaniam
No comments:
Post a Comment