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"); }