Writing Service Procedures for use with the Dynamics GP Service Based Architecture is straight forward but contains quite a few similar lines of code. From constructing the class if you are using an object, setting the properties of the class on a GET procedure or writing all the various MAP statements this can be a bit monotonous to do. We found the same to be true when developing our operations for the Dynamics GP 2015 release. To help us out with this we built a helper form in the dictionary that has quite a bit of functionality and can speed up the development of new service procedures. We call this form the ServiceCodeGenerator. It is available with the RTM of Dynamics GP 2015. The form allows an engineer to create the initial .Net class based off a table definition in the dictionary selected, build a text file of the MAP statements from the Object (Class) and the window and form needed to map to and also build a text file that has code to set the Object properties of the Class created from the fields in a table. There is also functionality to know if there are header and line tables that need to be considered as well.

First thing you will need to do is open this form. Being this is more of a development tool it is not part of the normal navigation for Dynamics GP. To open the form you will need to put a button on a form with the code

               open form ServiceCodeGenerator;

Once open (see screenshot), you can start making use of the form’s features.

The first feature on the window is to build a .Net Class from the contents of a table. For this post I picked the Prospects table (SOP_Prospect_MSTR) in the core Dynamics GP dictionary. I also called my .Net Class Prospects.

When the Create button is clicked the form will examine the table and create the base .Net Class for you.

From here you can make any changes necessary for how you want your class to be defined. This is also the time to decide on nullable properties or define your enums if needed. For drop down lists and radio groups the form creates an enum type for you. It is important to then ensure that the definition for those fields signifies this as well. If you choose to make no changes to the fields in the class that is ok. This class code can then be loaded into a solution and built for use with Dexterity through the .Net interop set of features and used with your service procedures.

The next feature of the ServiceCodeGenerator form is to assist in writing the sanScript MAP statements for use in the Wrapped Window model for a service procedure. For this I entered my Object, Window and Form names and clicked the Map Fields button. I saved the output to a text file and now I can copy that into a script in Dexterity.


The last feature I wanted to show in this post is how this form will help with the setting of the object properties from the table definition. To do this you need to keep the Table Name setup properly and then set the Object field in the “Set Object From Table” section of the window.


The output is sanScript code that can be pasted in to the appropriate script. If you have changed any of the generated property names or added additional properties to the class you would need to make the same changes here as the form doesn’t know of those changes.

As you can see this form and its features can be helpful when building Service Procedures for Dynamics GP. Try it out!