People is starting to get in and I couldn ' t be happier about it!! There is a lot of interest on services so I decided to write a couple different simple examples of what to call document SE Rvices in AX. I apologize for the formatting of code in this text editor, I promise when I wrote it, it looked like normal code:)
This calls the vendor service:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using Consoleapplication9.vendors;
Namespace ConsoleApplication9
{
Class Program
{
static void Main (string[] args)
{
Vendtableserviceclient proxy = new Vendtableserviceclient ();
CallContext context = new CallContext ();
Context.company = "CEU"; New class that replaces AX endpoints. It makes it obvious which company is importing data into. I Love this class!!
axdvendtable vendor = new axdvendtable ();
axdentity_vendtable[] Vendtables = new Axdentity_vendtable[1];
Axdentity_vendtable vendtable = new axdentity_vendtable ();
Vendtable.accountnum = "877778"; If your number sequences for vendor accounts is set to manual set this property Vendtable.currency = "USD"; Vendtable.vendgroup = "10";
Vendtable.name = "My Vendor Test Name";
Create the party record
Axdentity_dirpartytable_dirperson Party = new Axdentity_dirpartytable_dirperson ();
Party. Namealias = "First2";
Set the name fields
Axdentity_personname personname = new Axdentity_personname ();
Personname.firstname = "First2";
Personname.middlename = "Middle2";
Personname.lastname = "Last2";
Add the names to the party record and set the name sequence
Party. PersonName = new Axdentity_personname[1] {personname};
Party. Namesequence = "Firstlast"; vendtable.dirpartytable = new axdentity_dirpartytable_dirpartytable[1] {party};
Vendtables[0] = VendTable;
Vendor. VendTable = Vendtables;
Proxy.create (context, vendor);
}
}
}
This one was for customers:
Customerserviceclient proxy = new Customerserviceclient (); CallContext context = new CallContext (); Context.company = "CEU";
Axdcustomer customer = new Axdcustomer ();
axdentity_custtable CustTable = new axdentity _custtable (); custtable.accountnum = "998877"; custtable.currency = "USD"; Custtable.custgroup = "20"; Custtable.onetimecustomer = Axdexttype_ Onetimecustomer.yes; custtable.onetimecustomerspecified = true;
Create the party record Axdentity_dirparty_dirperson Party = new Axdentity_dirparty_dirperson (); Party. Namealias = "Becky";
Set the name fields Axdentity_personname personname = new Axdentity_personname (); Personname.firstname = "Becky"; Personname.middlename = "Iliveforthis"; Personname.lastname = "Newell";
//add The names to the party record and set the NAM E Sequence party. PersonName = new Axdentity_personname[1] {personname}; party. Namesequence = "Firstlast";
//create a postal address Axdentity_dirpartypostaladdressview address = new Axdentity_ Dirpartypostaladdressview (); address. LocationName = "Location Name"; address. Street = "2122 NE 5th St"; address. City = "Beverly Hills"; address. State = "CA"; address. Countryregionid = "USA"; address. ZipCode = "90210"; address. Roles = "Home;delivery";
//create an electronic address Axdentity_dirpartycontactinfoview electronicaddress = new Axdentity_dirpartycontactinfoview (); electronicaddress.locationname = "Contact Email "; Electronicaddress.type = axdenum_ Logisticselectronicaddressmethodtype.email; electronicaddress.typespecified = true; electronicaddress.locator = "[email protected] "; electronicaddress.roles = "Home";
ADD the addresses to the party record and the party to the CustTable record custtable.dirparty = new Axdenti TY_DIRPARTY_DIRPARTYTABLE[1] {party}; Custtable.dirparty[0]. Dirpartypostaladdressview = new axdentity_dirpartypostaladdressview[1] {address}; Custtable.dirparty[0]. Dirpartycontactinfoview = new Axdentity_dirpartycontactinfoview[1] {electronicaddress};
Add the CustTable record to the customer entity customer. CustTable = new Axdentity_custtable[1] {CustTable};
Create the customer proxy.create (context, customer);
For items your want to go off to this blog which shows what to import Items-http://blogs.msdn.com/b/dynamicsaxscm/arch Ive/2011/07/06/product-item-data-management-services.aspx
Importing Customers, vendors and products in AX 2012