Microsoft Great Plains integration capabilities using Dexterity and Visual Studio


Introduction:

Great Plains is one of the products in Microsoft Dynamic suite.

It is a full comprehensive accounting and business management system.  It contains all modules in a business process like Financial Management, Human Resource Management, and Customer Relationship Management etc.

Default installation path of GP is C:\Program Files\Microsoft Dynamics\GP 10. Under this path check  the below mentioned files

  1. Dynamics.exe
    This is the launcher file.
  2. Dynamics. set file
    This describes the products that are installed in the GP system. Open this file.  The first line shows the number of products installed and it increments if any new product was installed. And the second line contains 0(zero) which infers that GP is the launching one.
  3. Dynamics.dic file.
    Dictionaries play a vital role in GP.
  4. Dex.ini file present in C:\Program Files\Microsoft Dynamics\GP 10\Data.
    This is a settings file. 
    Some important properties are:
               Debugger = true, Synchronize = false, Script Debugger = true

Below are the integration capabilities provided in Microsoft Great Plains

Integration Capabilities:

  • Dexterity
  • COM
  • Modifier
  • VBA
  • E-Connect
  • Visual Studio
    1. Add – In
    2. Web Service
    3. SharePoint

Environment:

Windows Server 2003 , Visual Studio 2005 , SqlServer 2005 , Microsoft Dynamics Great Plains 10.0

After Visual Studio integration  for the development of new modules in the  existing applications developers can use Visual Studio Add- In Architecture.

For modifications of existing modules developers should have idea on Dexterity.

The article covers the above two integration capabilities in Great Plains.

Development with Dexterity

Follow the below mentioned steps:

Create a folder "Sample" in C drive.

Copy "Dynamics.dic" from installation folder (C:\Program Files\Microsoft Dynamics\GP 10\) and paste it in "C:\ Sample" folder.

Then navigate: Start -> Programs -> Microsoft Dexterity -> Dex 10.0 -> Dexterity

It opens Dexterity window. Select "Open an existing dictionary" option and in Dictionary Name browse "Dynamics.dic" file from "C:\Sample" folder. Then press Ok. It creates .Dat files and Sql Server Replication Snapshot Index Script files in "C:\Sample\" folder.

It opens "Resource Explorer"  window.

In the left pane tree view select "Dynamics.dic" and expand it. Select  "Scripts".

From the menu bar click "New" which is upper left side corner. It opens Script Editor. In the "Procedure" textbox give a name let"s say "Sample_Warning"

Then in the textarea provided type this:

warning "Testing";

Then click on Compile button. It should have zero errors. Then press Close button.


 
Open "Resource Explorer" window again. Select   "Scripts" under   "Dynamics.dic" in the left side tree view.

Click "New" from the left upper side corner. Give "Startup" in the "Procedure" textbox.

"Startup" should be the name of the procedure. It"s mandatory to give the name as "Startup" because Dexterity invokes the new products after looking this "Startup" procedure.

The sample example provided here shows a warning message on click of "Process" button in Sales Bulk Confirmation.

For knowing the names of the form (Sales Bulk Confirmation) and button (Process) follow the below procedure.

Click on "Names" button in "Script Editor" window. Then "Names" window opens. Click on "Forms" button. Select "SOP_BulkConfirm" form from the Forms dropdown. Click on "Windows" button and select "SOP_BulkConfirm" from the "Windows" dropdown. Click on "Window Fields" button and select "Process Button P". 


 
Write the below code in the text area provided in Script Editor:

{Name: Startup}
{Register the focus trigger that runs when the Applicants window restarts.}
local integer result;
result = Trigger_RegisterFocusByName(0, "Clear  Button P' of window SOP_BulkConfirm of form SOP_BulkConfirm", TRIGGER_FOCUS_CHANGE, TRIGGER_AFTER_ORIGINAL,  script Sample_Warning);
if result <> SY_NOERR then
    warning "Focus trigger registration failed.";
end if;

Then click on Compile button. It should have zero errors. Then press Close button.

Then navigate: Start -> Programs -> Microsoft Dexterity -> Dex 10.0 -> Dexterity Utilities

Then File -> Open Source Dictionary and select "Dynamics.dic" file from the "C:\Sample\" folder.

Then from the second row click "Utilities" and then select "Extract". "Extract" window opens. Check the path of the "Source Dictionary" and press Ok button. Then "Extracted  Dictionary Name" window appears. Save the file by giving name as "Extract" in "C:\Sample" folder.


 
Then File -> Close Source Dictionary.

Then File -> Open Editable Dictionary and select "Extract.dic" file from "C:\Sample\" folder.

Then again from the second row click "Utilities" and select "Create Product Information". It opens "Product Information" window.

Enter details in the "Product Information" window as per the diagram Eigth_Product_Information.


 
Here Launch File should be always "DYNAMICS.SET" file and Launch ID is 0(zero).

Enter a number which is greater than 20000 for "Product ID" and it should be an unique number. In live environment raise a request for this to Microsoft .

Then click Ok in "Product Information" window.

Then again from the second row click "Utilities" and select "Auto-Chunk".

In the "Auto-Chunk "window click the browse(…) button beside "Chunk Dictionary". In the "Select Pathname" window give filename as "Extract.cnk" and save the file in this location "C:\Sample\" folder.

In the "Auto-Chunk" window give name for "Dictionary" say "SaExtract.dic". Once this product gets installed in GP it appears in "C:\Programs Files\Microsoft Dynamics\GP10\".

Enter the remaining information.

Press Ok button.

Now copy "Extract.cnk" file from "C:\Sample\" and paste it in "C:\Programs Files\Microsoft Dynamics\GP10\".

Then Start --> Programs --> Microsoft Dynamics --> GP 10.0-Gp10  - -> GP

A popup window appears to include the new product .

Press Yes. 

"SaExtract.Dic" file gets created in "C:\Programs Files\Microsoft Dynamics\GP10\".

After successful login into GP  open Sales -> Bulk Confirmation. On click of Clear button a warning message "Testing" appears. It infers that the product was successfully installed in GP.

Open Dynamics. set file . Number of products is increased by one. Look at the name of product also.

In GP Utilities Macros option is there to record the above steps and play whenever required. It saves lot of time and the whole process is automated with this Macro option.

Great Plains : Visual Studio AddIn Architecture

Environment : Visual Studio 2005, GP 10 , Sql Server 2005

File - > New Project Visual C#  select Class Library template

Enter Name let"s  say " SampleAddIn " and press Ok.

Right Click on Add Reference.  Click on Browse. Navigate to "C:\Programs Files\Microsoft Dynamics\GP10\" and select the follow dlls.

Microsoft.Dexterity.Bridge.dll
Application.Dynamics.dll
Microsoft.Dexterity.Shell.dll(not required)

Under .Net tab in Add Reference window select  System.Windows.Forms.dll also. Delete Class1.cs file and add a new class by name "SampleClass"

Add the below namespaces

using Microsoft.Dexterity.Bridge;
using Microsoft.Dexterity.Applications;
using System.Windows.Forms;
Extend the interface "IDexterityAddIn" to class "SampleClass" .

Start --> Programs --> Microsoft Dynamics --> GP 10.0-Gp10  - -> GP

After successful login into GP Go to Sales then  click on "Bulk Confirmation" link.

Dex.ini file present in C:\Program Files\Microsoft Dynamics\GP 10\Data.
This is a settings file. 
Some important properties are:
           Debugger = true, Synchronize = false, Script Debugger = true

Then debug button appears in GP web client

Press CTRL + F1  . A small symbol comes . Keep that on "Process button" and click on it."Open Script" window appears and from this "Forms", "Form objects, " Window Objects", "Scripts" names are known that are used in coding.

From GP10  ClickAfterOriginal and ClickBeforeOriginal events are available.

Now the current program  shows a message box showing that "Processing" on click of "Process button" and adds a menu by name "SampleMenu" in  Sales -> Bulk Confirmation window.

Code for sample message

Dynamics.Forms.SopBulkConfirm.SopBulkConfirm.ProcessButtonP.ClickAfterOriginal += new EventHandler(ProcessButtonP_ClickAfterOriginal);

Code for sample menu

 

            Dynamics.Forms.SopBulkConfirm.AddMenuHandler(new EventHandler(SampleScript), "SampleMenu");

        }

 

And the complete source code is :

 

using System;

using Microsoft.Dexterity.Bridge;

using Microsoft.Dexterity.Applications;

using System.Windows.Forms;

 

namespace SampleAddIn

{

    class SampleClass : IDexterityAddIn

    {

        #region IDexterityAddIn Members

 

        public void Initialize()

        {

            Dynamics.Forms.SopBulkConfirm.SopBulkConfirm.ProcessButtonP.ClickAfterOriginal += new EventHandler(ProcessButtonP_ClickAfterOriginal);

            Dynamics.Forms.SopBulkConfirm.AddMenuHandler(new EventHandler(SampleScript), "Sample Menu");

        }

        void SampleScript(object sender, EventArgs e)

        {

            MessageBox.Show("From the Menu");

        }

        void ProcessButtonP_ClickAfterOriginal(object sender, EventArgs e)

        {

            MessageBox.Show("Processing.");

        }

 

        #endregion

    }

}

Copy the SampleAddIn.dll from this project bin folder into C:\Program Files\Microsoft Dynamics\GP10\AddIns

Then Start --> Programs --> Microsoft Dynamics --> GP 10.0-Gp10  - -> GP

After successful login into GP, Go to sales -> Bulk Confimation link

In Sales Bulk Confirmation window "Additional" menu gets created . Under this "Sample Menu" appears.

On click of "Sample Menu" "From the Menu" message appears.


 
On click of "Process" button "Processing"message appears.

"AddIns" is the place where the managed dlls should be placed for integration third party dlls in GP.

Hope this article helps you in taking the initial steps in Great Plains.

Thanks. Happy coding.