Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

How to call dexterity function from c# using eConnect?

Posted on by Microsoft Employee

Hi All,

Could you give solution for below one.

How to call dexterity function from c# using eConnect?

Thanks and  Regards

Vamsi

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call dexterity function from c# using eConnect?

    Hi ManiKandan,

    Can you guide me on below one.

    How to use Vstools in c# and give me sample code for calling dexterity procedure from c#?

    Thanks

    Vamsi

  • Suggested answer
    Manikandan Profile Picture
    Manikandan 2,845 on at
    RE: How to call dexterity function from c# using eConnect?

    Vstools comes with GP setup folder. There itself you can find sample too.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call dexterity function from c# using eConnect?

    Hi Manikandan,

    I am new to the Dynamics Gp, Could you tell me, where can i download VSTools and also provide me sample code for calling dexterity procedure from c#.

    Thanks

    Vamsi

  • Suggested answer
    Manikandan Profile Picture
    Manikandan 2,845 on at
    RE: How to call dexterity function from c# using eConnect?

    You can use the VSTools to call dex code in c#.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call dexterity function from c# using eConnect?

    Hi Praveen,

    i need to call dexterity function or procedure or batch using c# code?

    Thanks

    Vamsi

  • Suggested answer
    Praveen Kumar RR Profile Picture
    Praveen Kumar RR 1,550 on at
    RE: How to call dexterity function from c# using eConnect?

    Hi,

    I believe you want to integrate an application with GP using eConnect and need to pass the Data to eConnect right ?!

    You can explore below link to know more about eConnect and its Schemas,

    msdn.microsoft.com/.../aa155259.aspx

    If you are in different requirement, please provide more clarity.

    Further more i suggest you can develop SQL Stored Procedure and use inside C# if there is no Schema for any particular feature, but need to be much careful in updating all relevant tables.

    Below sample code available on Microsoft Portal,

    Sample Code for eConnect on C#

    using System;

    using System.IO;

    using System.Data;

    using System.Text;

    using System.Windows.Forms;

    using System.Xml;

    using System.Xml.Serialization;

    using Microsoft.Dynamics.GP.eConnect;

    using Microsoft.Dynamics.GP.eConnect.Serialization;

    namespace eConnectSample

    {

       public partial class InventoryItemCreate : Form

       {

           public InventoryItemCreate()

           {

               InitializeComponent();

           }

           private static void sendtogp()

           {

               using (eConnectMethods eConCall = new eConnectMethods())

               {

                   try

                   {

                       SerializeObject("c:\\test\\eConnect.xml");

                       XmlDocument xmldoc = new XmlDocument();

                       xmldoc.Load("c:\\test\\eConnect.xml");

                       string send2gp = xmldoc.OuterXml;

                       string sConnectionString = "data source=sqlserver;initial catalog=TWO;integrated security=SSPI;persist security info=False;packet size=4096";

                       string ivitem = eConCall.CreateTransactionEntity(sConnectionString, send2gp);

                   }

                   catch (eConnectException exp)

                   {

                       MessageBox.Show(exp.ToString());

                   }

                   catch (Exception ex)

                   {

                       MessageBox.Show(ex.ToString());

                   }

                   finally

                   {

                       eConCall.Dispose();

                       MessageBox.Show("done");

                   }

               }

           }

           private static void SerializeObject(string filename)

           {

               try

               {

                   taUpdateCreateItemRcd itm = new taUpdateCreateItemRcd();

                   itm.ITEMNMBR = "ITEMNAME";

                   itm.ITEMDESC = "Item description";

                   itm.ITMSHNAM = "Short Description";

                   itm.ITMGEDSC = "Generic description";

                   itm.ITMCLSCD = "FG-ACT";

                   itm.ITEMTYPE = 1;

                   itm.UOMSCHDL = "EACH";

                   itm.UpdateIfExists = 1;

                   IVItemMasterType iv = new IVItemMasterType();

                   iv.taUpdateCreateItemRcd = itm;

                   IVItemMasterType[] myIV = { iv };

                   eConnectType eConnect = new eConnectType();

                   eConnect.IVItemMasterType = myIV;

                   FileStream fs = new FileStream(filename, FileMode.Create);

                   XmlTextWriter writer = new XmlTextWriter(fs, new UTF8Encoding());

                   XmlSerializer serializer = new XmlSerializer(eConnect.GetType());

                   serializer.Serialize(writer, eConnect);

                   writer.Close();

               }

               catch (eConnectException ex)

               {

                   MessageBox.Show(ex.ToString());

               }

           }

           private void Send2GP_Click(object sender, EventArgs e)

           {

               sendtogp();

           }

       }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans