Quantcast
Channel: Microsoft Dynamics GP Forum - Recent Threads
Viewing all articles
Browse latest Browse all 14686

SOP Entry in VSTDGP

$
0
0

Hi,

I am working on a project that uses the SOP_Entry window. 

The client wants to verify distributions and, if certain criteria are not met, can posting with a warning message to the user.

i found Mariano's post, which was a great start.

http://dynamicsgpblogster.blogspot.com/2009/12/vst-working-with-action-button-in-sop.html

I put together a quick event handler triggering on the ActionButton_ValidateBeforeOriginal event (see below)  but I am getting mixed results.  If i start a new transaction, I can get DocumentNumber.Value

However, if I edit an existing transaction, DocumentNumber is empty.

What am i doing wrong? 

Regards

Habib

-----------------------------------------

       private void SOPActionButton_ValidateBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)

        {

            // define variables to use with Continuum Library

            int compilerErrorCode;

            string compilerErrorMsg;

            string compilerCmd;

           

            // create an instance of the Dynamics Application and clear the DDL

            Dynamics.Application compilerApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));

 

            // fill the DDL with sanscript

            compilerCmd = "'(L) LATAM LineItemSequence_Return' of window SOP_Entry of form SOP_Entry = itemdata('Action Button' of window SOP_Entry of form SOP_Entry, 'Action Button' of window SOP_Entry of form SOP_Entry);";

 

            compilerApp.CurrentProductID = 0;   //Dynamics

            compilerErrorCode = compilerApp.ExecuteSanscript(compilerCmd, out compilerErrorMsg);

 

            if (compilerErrorCode != 0)

            {

                MessageBox.Show(compilerErrorMsg);

            }

 

            //this line returns a value of 1 if user clicks on Actions > Post

            MessageBox.Show(GP.Forms.SopEntry.SopEntry.LocalLatamLineItemSequenceReturn.Value.ToString());

         

//--- this code below does not work when editing a saved transaction

 

            short val = GP.Forms.SopEntry.SopEntry.Action.Value;

            string docnumber = GP.Forms.SopEntry.SopEntry.DocumentNumber.Value;

            

            // this does not always work

            MessageBox.Show(GP.Forms.SopEntry.SopEntry.DocumentNumber.Value.ToString());

 

 

            e.Cancel = true;

 

        }


Viewing all articles
Browse latest Browse all 14686

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>