Copy entry types via web services in Acumatica from one instance into another

Hello everybody.

Today I want to share how to copy Entty Types items in acumaticca from one instance into another instance.

The first step was to create import export settings in both instances of acumatica as described in acumatica manual similar to this screenshot:

The second step was to create project, which I decided to make as windows forms application with the following input fields:

For the button click at entry types write the following:

           var context = new ImportEt.Screen
                {
                    CookieContainer = new CookieContainer(), AllowAutoRedirect = true, EnableDecompression = true, Timeout = 1000000, Url = txtFrom.Text
                };

           var lgRes = context.Login(txtUserName.Text, txtPassword.Text);
           if (lgRes.Code == ErrorCode.OK)
           {
                var ca203000 = context.CA203000GetSchema();
                context.CA203000Clear();


                var export = context.CA203000Export(
                    new Command[]
                        {
                            ca203000.EntryType.EntryTypeID, ca203000.EntryType.DisbReceipt, ca203000.EntryType.EntryTypeDescription, ca203000.EntryType.Module, 
ca203000.EntryType.BusinessAccount, ca203000.EntryType.DefaultOffsetAccount, ca203000.EntryType.UseForPaymentsReclassification,
ca203000.EntryType.ReclassificationAccount, ca203000.EntryType.DeductFromPayment }, null, 0, false, false); context.Url = txtTo.Text; var lgRes2 = context.Login(txtUserName.Text, txtPassword.Text); if (lgRes2.Code == ErrorCode.OK) { ca203000 = context.CA203000GetSchema(); context.CA203000Clear(); foreach (var et in export) { var ca203000ImportResults = context.CA203000Submit( new Command[] { new Value { Value = et[0], LinkedCommand = ca203000.EntryType.EntryTypeID}, new Value { Value = et[1], LinkedCommand = ca203000.EntryType.DisbReceipt }, new Value { Value = et[2], LinkedCommand = ca203000.EntryType.EntryTypeDescription }, new Value { Value = et[3], LinkedCommand = ca203000.EntryType.Module }, new Value { Value = et[4], LinkedCommand = ca203000.EntryType.BusinessAccount }, new Value { Value = et[5], LinkedCommand = ca203000.EntryType.DefaultOffsetAccount }, new Value { Value = et[6], LinkedCommand = ca203000.EntryType.UseForPaymentsReclassification }, new Value { Value = et[7], LinkedCommand = ca203000.EntryType.ReclassificationAccount }, new Value { Value = et[8], LinkedCommand = ca203000.EntryType.DeductFromPayment }, ca203000.Actions.Save }); } } }

All activities in Acumatica are done via interface context, whic is of type screen. 

As for me, the easiest way to get some data is via command "screenID" + export. In my code you can see construction CA203000Export. Inside of it you can point to id of screen, data of which you want to receive. For example CA203000Export.

The simplest way to send something to acumatica another instance is function "screen id" + "Submit". In my code you can see method CA203000Submit. Fields Value is self-explanatory as for me. The most important and hard to understand for me was LinkedCommand. It can be name of the field. That means values has to be putted into a field. It can be action name to push on and etc. 

Another important facet of mentioned code is Actions.Save. If it is not mentioned, than code will post data to web services, but they wil not be saved.

P.S.    source code

1 Comment

  • Hari said

    Thak you very much for this tutorial.
    it's really help me to study more, especially in acumatica web service :)

Add a Comment