tag:blogger.com,1999:blog-4889748320010274206.post2161464219931202489..comments2024-03-29T02:03:40.652-04:00Comments on AX WONDERS: Create a Transfer Journal using AX 2012 R2 Document Services and C#AxWondershttp://www.blogger.com/profile/01901411966215366187noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4889748320010274206.post-20555246119936622002013-09-26T10:04:48.230-04:002013-09-26T10:04:48.230-04:00Hi,
I have a sale order code. Just go to AX and i...Hi,<br /><br />I have a sale order code. Just go to AX and in the code replace the entity. <br /><br />using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Text;<br />using ConsumeSalesOrderService.SalesOrder;<br />// Add a using statement for the service reference.<br />using System.Collections; <br /><br />namespace ConsumeSalesOrderService<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> // Instantiate an instance of the service client class.<br /> SalesOrderServiceClient proxy = new SalesOrderServiceClient();<br /><br /> // Create an instance of the document class.<br /> AxdSalesOrder salesOrder = new AxdSalesOrder();<br /><br /> // Create instances of the entities that are used in the service and<br /> // set the needed fields on those entities.<br /> AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();<br /> salesTable.CurrencyCode = "USD";<br /> salesTable.CustAccount = "1101";<br /> salesTable.DeliveryDate = Convert.ToDateTime("2/14/2010");<br /> salesTable.Payment = "N060";<br /> salesTable.PurchOrderFormNum = "PO";<br /><br /> AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();<br /> salesLine.ItemId = "1001";<br /> salesLine.SalesQty = 88;<br /> salesLine.SalesUnit = "ea";<br /><br /> AxdEntity_InventDim inventDim = new AxdEntity_InventDim();<br /> inventDim.configId = "HD";<br /> inventDim.InventColorId = "01";<br /> inventDim.InventSizeId = "42";<br /><br /> // Add the sub-entity instances to their parent entities as an array<br /> // of the sub-entity type.<br /> salesLine.InventDim = new AxdEntity_InventDim[1] { inventDim };<br /> salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine };<br /> salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable };<br /><br /> try<br /> {<br /> // Call the create method on the service passing in the document.<br /> EntityKey[] returnedSalesOrderEntityKey = proxy.create(salesOrder);<br /><br /> // The create method returns an EntityKey which contains the ID of the sales order.<br /> EntityKey returnedSalesOrder = (EntityKey)returnedSalesOrderEntityKey.GetValue(0);<br /> Console.WriteLine("The sales order created has a Sales ID of " + returnedSalesOrder.KeyData[0].Value);<br /> Console.ReadLine();<br /> <br /> }<br /> catch (Exception e)<br /> {<br /> Console.WriteLine(e.ToString());<br /> Console.ReadLine();<br /> }<br /> }<br /> }<br />}<br />AxWondershttps://www.blogger.com/profile/01901411966215366187noreply@blogger.comtag:blogger.com,1999:blog-4889748320010274206.post-46044668668496510422013-09-25T17:22:43.644-04:002013-09-25T17:22:43.644-04:00Hi, perhaps I could ask for a favour.
Im trying to...Hi, perhaps I could ask for a favour.<br />Im trying to implement some C# code to call a document service i created based on the PurchTable and Purch Line Tables<br /><br />The idea is to consume data on a light switch screen and create a purchase order in Ax2012.<br />Ive used the transfer journal example to start on my code, but cant seem to get the iteration right.<br /><br />Could you look into posting a class that posts an order with 3 lines.<br /><br />Thanksajnarhttps://www.blogger.com/profile/15128269550395007327noreply@blogger.com