Hi,
I was using eConnect to connect my .net application with the Microsoft Dynamics GP, and below is my code I was using.
using (eConnectMethods eConnectMethods = new eConnectMethods()) { SOPTransactionType salesOrder = new SOPTransactionType(); taSopLineIvcInsert_ItemsTaSopLineIvcInsert salesLine = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert(); taSopHdrIvcInsert salesHdr = new taSopHdrIvcInsert(); taSopLineIvcInsert_ItemsTaSopLineIvcInsert[] LineItems = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert[1]; salesLine.CUSTNMBR = "PLAZAONE0001"; salesLine.SOPTYPE = 2; salesLine.DOCID = "STDORD"; salesLine.QUANTITY = 2; salesLine.ITEMNMBR = "3-B3813A"; salesLine.UNITPRCE = 100; salesLine.XTNDPRCE = 200; salesLine.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy"); LineItems[0] = salesLine; salesOrder.taSopLineIvcInsert_Items = LineItems; salesHdr.SOPTYPE = 2; salesHdr.DOCID = "STDORD"; salesHdr.BACHNUMB = "B1"; salesHdr.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy"); salesHdr.CUSTNMBR = "PLAZAONE0001"; salesHdr.SUBTOTAL = 200; salesHdr.DOCAMNT = 200; salesHdr.USINGHEADERLEVELTAXES = 0; salesHdr.PYMTRMID = "Net 30"; salesOrder.taSopHdrIvcInsert = salesHdr; eConnectType eConnect = new eConnectType(); SOPTransactionType[] MySopTransactionType = new SOPTransactionType[1] { salesOrder }; eConnect.SOPTransactionType = MySopTransactionType; // Serialize the master vendor type in memory. MemoryStream memoryStream = new MemoryStream(); XmlSerializer xmlSerializer = new XmlSerializer(eConnect.GetType()); // Serialize the eConnectType. xmlSerializer.Serialize(memoryStream, eConnect); // Reset the position of the memory stream to the start. memoryStream.Position = 0; // Create an XmlDocument from the serialized eConnectType in memory. XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(memoryStream); memoryStream.Close(); // Call eConnect to process the XmlDocument. eConnectMethods.CreateEntity(connectionString, xmlDocument.OuterXml); }
This creates sales entry transaction in Dynamics GP, and how can I get Sales Number for the newly created entry from this code.
*This post is locked for comments