web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

SOP Entry in VSTDGP

(0) ShareShare
ReportReport
Posted on by 290

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;

 

        }

*This post is locked for comments

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans