Microsoft Dynamics GP Developing for Dynamics GP
A blog dedicated to the Microsoft Dynamics GP Developer & Consultant community
 
Welcome to MSDN Blogs Sign in | Join | Help

Developing for Dynamics GP

by David Musgrave (Australia) and the Microsoft Dynamics GP Developer Support Team (USA)

News

  • Please use the Blog Feedback? - Contact Us link at the top of the page to email questions relating to the blog itself.

    If you wish to ask a technical question, please use the links below to ask on the Newsgroups. If you ask on the Newsgroups, others in the community can respond and the answers are available for everyone in the future.

    Please do not use comments on pages and posts to ask questions unrelated to the topic on that page or post.



    Dates of Interest:

    11-Jul-2008: Blog Created by David Musgrave.
    10-Oct-2008: First Post by Scott Stephenson.
    04-Nov-2008: First Post by Dave Dusek.
    11-Nov-2008: First Post by Beth Gardner.
    28-Nov-2008: First Post by Chris Roehrich.
    30-Dec-2008: First Post by Patrick Roth.
    24-Feb-2009: First Post by Greg Willson.
    22-Apr-2009: First Post by David Clauson.
    04-May-2009: First Post by Ryan Wigestrand.
    19-Jun-2009: First Post by Dawn Langlie.
    03-Jul-2009: First Post by Emily Halvorson.
    23-Sep-2009: Created Twitter account with blog feed.
    20-Nov-2009: First Post by Alice Newsam.



    WorldMaps Statistics since
    24-Feb-2009:




    Click for WorldMaps Stumbler



    Translator Tool:




    Social Networking

    Follow David Musgrave and the blog on:

    David Musgrave on Twitter

    David Musgrave on LinkedIn


    Disclaimer

    This blog is provided "AS IS" with no warranties, and confers no rights.

    The links in this blog may lead to third-party Web sites. Microsoft provides third-party resources to help you find customer service and/or technical support resources. Information at these sites may change without notice. Microsoft is not responsible for the content at any third-party Web sites and does not guarantee the accuracy of third-party information.

Contents

Favourite Posts

Blog Links

Newsgroups Links

Resources Links

Using the Dexterity Three Trigger Technique Part 2

David MeegoIn the previous part of this post we discussed the theory of the Three Trigger Technique and the details of a problem that was solved using this technique.

This post will cover the actual solution used and has the scripts used so you can see the techniques in action.

The Solution

Before we can look at the scripts involved we need to create two global system variables.  We need to create the following Fields and then add them as Globals

  1. 'MBS Trigger Active' using Data Type of Boolean. This is the global system variable that tells us when we are inside the Script A mentioned previously.
     
  2. 'MBS Table Reference' using Data Type of Reference. This global system variable will be used to allow us to capture a table reference which can then be instantiated in our trigger script.

As we are running  Cross Dictionary code as well, it is best practice to create a Constant for the third party dictionary.

  • MBS_PROD_COPIER with a value of 2992, which is the Product ID for the Copier Series.

Now we are ready to create the code. Below is the Startup script to register the triggers and the three triggers of the technique.

The Code

The Startup script registers the triggers.  It checks that we are not test mode and then confirms that the Copier Series dictionary is installed before registering the triggers.  There are cross dictionary triggers before and after the function Copy_PO of form QPOP_Copy. Then there is the trigger against the function SetNonIVItemID of form POP_POLine in the core Dynamics.dic.

Global Procedure: Startup

The script below is the first trigger in the three trigger technique. It is used to set our global system variable as well as capture a reference to the table QPOP_POLine.

Global Function: MBS_QPOP_Copy_Copy_PO_PRE

The next script is the second trigger of the three trigger technique. It is used to clear our global system variable and clear the previously captured table reference.

Global Procedure: MBS_QPOP_Copy_Copy_PO_POST

The following script is third and final script of the three trigger technique and actually contains the working code of our "fix".  The check of 'MBS Trigger Active' of globals is important as this prevents our trigger from running when the SetNonIVItemID of form POP_POLine function is called from anywhere else.

The rest of the code is specific to the fix and includes checks to ensure that the script we are triggering against has not returned a status code to signify it has failed, as well as checks to confirm the current document is not part of a Blanket PO.  Assuming that we passed the checks the code sets the Unit of Measure using the value from the 'U Of M' field in the table QPOP_POLine, which was re-instantiated from the captured reference.

Global Function: MBS_POP_POLine_SetNonIVItemID_POST

Don't worry about the specifics of the actual fix here, but make sure you understand the following important concepts covered:

  • Three Trigger Technique
  • Cross Dictionary Triggers
  • Capturing and Using References

Please let me know if you find this information useful.

David

23-Nov-2009: See follow-up article Accessing a Table Buffer when it is not passed as a parameter.

Posted: Monday, March 30, 2009 9:00 AM by David Musgrave

Comments

David Musgrave said:

# March 30, 2009 10:24 PM

Developing for Dynamics GP said:

When working with Dexterity triggers, the hardest part of the process is working out where to place the

# April 6, 2009 3:26 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker