Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to Execute a Dexterity Procedure Programmatically

(0) ShareShare
ReportReport
Posted on by 75,788 Moderator

I stumbled upon this article full of sample C# code.

https://learn.microsoft.com/en-us/dynamics/s-e/gp/mdgp2013_vstoolssamples_349

I am most interested in the code pertaining to posting a batch. Does any documentation exist for valid values of

nWindowType

nActivityType

nstatus

or even

Microsoft.Dexterity.Applications.Dynamics.Procedures.PostingRptDestWdw.Invoke
                        ("", "SOP Posting Journal", "SOP Posting Journal", "SOP Posting Journal", 3, ref reportDestination);

and most importantly

Dynamics.Forms.Batch.Procedures.Post.Invoke
                        (BatchSource, BatchNumber, nWindowType, nActivityType, DestID, ref nStatus);

I need to adjust this to post financial batches. This code will be run as a class library(dll).

                //clear posting destid's array.
                string[] DestID = new string[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
                string BatchSource = "Sales Entry"; //BATCH_SOURCE_SOP_ENTRY
                Int16 nWindowType = 2;   //BATCH_WINDOW
                Int16 nActivityType = 3; //SY_BA_EDITLIST = 3, SY_BA_POSTING = 2
                string BatchNumber = this.batchNumber.Text;
                //inout nStatus in posting call
                Microsoft.Dexterity.Bridge.Field<short> nStatus = new Field<short>(0);
                Field<string> reportDestination = new Field<string>("");

                    //Printing the edit list and so only need 1 param for DestID
                    //let's prompt the user for the destination using the Dynamics Report Restination
                    Microsoft.Dexterity.Applications.Dynamics.Procedures.PostingRptDestWdw.Invoke
                        ("", "SOP Posting Journal", "SOP Posting Journal", "SOP Posting Journal", 3, ref reportDestination);

                    //copy our read/write destid from above to our array
                    DestID[0] = reportDestination.Value;
                    nActivityType = 3;

                    //here is how you use the ValueArray function.  
                    //We initialize it with our array above
                    FieldArray< string> DestIDArray = DestID;

                //call posting, edit list routine
                Dynamics.Forms.Batch.Procedures.Post.Invoke
                        (BatchSource, BatchNumber, nWindowType, nActivityType, DestID, ref nStatus);
                if (nStatus != 0)
                { MessageBox.Show("Posting failed"); }

Categories:
  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,965 Most Valuable Professional on at
    RE: How to Execute a Dexterity Procedure Programmatically

    SQL profile will not help.

    You need to capture a Dexterity Script Log for the parameters.

    To get the reports to not print, use Batch Posting Service Toolkit.

    Regards

    David 

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: How to Execute a Dexterity Procedure Programmatically

    I was hoping for some documentation but if none exist SQL Profiler will have to do. I will need to discover how to get it to not print at all for these imports.

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,965 Most Valuable Professional on at
    RE: How to Execute a Dexterity Procedure Programmatically

    Hi Richard

    That example is a good find.

    Capture a script log of posting via the UI to get the values you should use for those variables.

    PS: That code might still print reports or open dialogs. Batch Posting Service Toolkit does handle all of the reports and dialogs automatically.

    Regards

    David

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans