Dynamic Code Blocks

Microsoft Dynamics GP & .NET technical Blog by Tim Wappat

Visual Studio Auto Shelve Extension

Quality and finance audits

In your annual audits, as a software manager the question always crops up of how is work in progress protected? All the project source code is normally safely locked away in team foundation server. The Team Foundation Server is in turn backed up and backup shipped off site. What about drive failure on the local developer machine? Normally hours or days of work could be lost since the last check was performed!
My answer to this is to use Auto Shelve extension and a weekly machine backup of my development machines.

Auto Shelve protects work loss from drive failure since last checkin

Auto shelve is a Visual Studio extension that periodically & automatically shelves your pending changes into source control as you work. It does this in background and so has minimal impact. Should my SSD drive fail catastrophically, work since my last check in will have been preserved in a shelf set in the team foundation server.

image 

After setting it up, Auto Shelve keeps overwriting the shelf set with the latest pending changes. After using it for some time now I can say it is effortless backup and I love it. I will love it even more when the day comes that I have a disaster on my hands.

Install

Install it through Tools>>Extensions and Updates

Search on the online node to the left, for autoshelve and install.

Go to the settings to set up your shelf set name and the frequency of shelving.

image

Dynamics GP Visual Studio Addin - Open Form Parameters

Opening a native GP form from VS addin

This post covers a self help pattern, to assist developers wishing to open a native GP form from .NET using Visual Studio Tools For GP addin.
An example is needed to work with, say it was required to open the Manufacturer’s Item Number Maintenance form from our .NET code:

image 

This form is normally only available from the Item Purchasing Options Maintenance Form but in this example it is required to launch it from our .NET code.

Identify the form name

Using the title caption from the form, go into Tools>Customise>Modifier to find the name of the form, or use the resource tool found under Tools>Resource Descriptions>Windows

IF using the resource tool, the product should be selected to which the form belongs, in this example Microsoft Dynamics GP, set Series Inventory, set View by display name.

image

Here we can see its called IV_MFG_Item_Nmbr_Mnt internally. Forms have display and internal names.

By typing in Visual Studio the window can be located by following intellisense, starting at the dictionary it belongs to (MicrosoftDynamicsGP) and taking out the underscores from the Dex name found above as it is typed.

Once the form is located, put a period after the form name to see what procedures it supports, typing “open” flushes out the procedures of interest.

image

It can be seen that to open the form, this form uses: OpenIvMfgItemNmbrMntProcedure

Intellisense also guides as to how to call it using  _Instance.Invoke
image

However, a familiar issue is hit at this point. The open procedure requires two parameters passing. What are the two parameters that intellisense is asking for? Luckily help is at hand, from the tooltip (see image above),

Invokes form procedure “Open_IV_MFG_Item_Mnt” of form “IV_MFG_Nmbr_Mnt”

Thus recalling that all that is happening here is a call down to procedures in the underlying dexterity code, we can find what we need to call this by checking the Software Developer Kit (SDK).

You of course have the GP SDK installed? – if not get it now…

Using the SDK to find parameters

Searching on the SDK folder, C:\program Files\Microsoft Dynamics\GP11.0 SDK\Content   for the start of the procedure name “Open_IV_MFG” a hit is returned in a file called “CoreForms_1100.txt”

Opening CoreForms_1100.txt, and search for the same term. The following text is found in the document …

------------------------------------------------------------------------
INVENTORY FORM PROCEDURE:  Open_IV_MFG_Item_Nmbr_Mnt
    of form IV_MFG_Item_Nmbr_Mnt
------------------------------------------------------------------------
in                       'Item Number'            l_item;
in                       'Item Description'       l_Description;

So the two parameters needed are Item Number and Item Description.

So now we call it like this:

MicrosoftDynamicsGpDictionary.IvMfgItemNmbrMntForm.OpenIvMfgItemNmbrMntProcedure._Instance.Invoke
("testpart", "testpart description")

Compile, deploy and you should find the form opens with the item selected!

 

Fix for Dynamics GP Add-In Initalization Error launching GP 2010,sp3

Problem

Building a new Dynamics GP 2010 client I experienced the following error on putting our customisations into the GP 2010 Addin directory. When launching the GP application, the application crashed out.

Microsoft.Dynamics.GP.BusinessIntelligence.BIReportDeploymentGP.dll: Method not found: ‘ClearCompanyListProcedure FormProcedures.get_ClearCompanyList()’.

 

image

Clue to my issue was in the forum posing here:
Login Problem in Microsoft Dynamics GP 2010- where MUFADDAL SHAKIR suggested that

removing Application.Dynamics.dll from the Addins folder resolved the issue

Ok it solved the issue but will mean that dll is not available to use which is no good for me, however it immediately occurred to me what had happened. In my GP application directory there is a copy of the current Application.Dynamics.dll, Checking its version it was 11.00.0363.000,

imageimage

then checking the one I was referencing in Visual Studio, that due to the deployment was also  the one held in the addins folder, I found it was version 11.00.0218.000. Classic file version control issues had struck! Somehow, I’m not certain how, an old version of the dll was still in source control and had been pulled into my machine’s addin folder in development.

Solution

Hence when the old dll was replaced by the new, everything worked as it should again. I guess this is a new method added into dynamics dic during one of the releases what could not be found.

Architecture

Just to remind you & me of the key dlls involved in visual studio dynamics gp Add-ins:

Microsoft.Dexterity.Shell.dll Used by visual studio do draw the right looking UI to the canvas
Microsoft.Dexterity.Bridge.dll Events and resources bridge to application dictionaries
Application.Dynamics.dll (and others) Dynamics.Dic default assembly, representing the actual methods and events in that GP application dictionary.
A long list of which can be found in your application directory, see below screenshot, you reference what you use:image

Use the DAG.EXE to generate your own for modified forms…

All this is covered in: Visual Studio® Tools for Microsoft Dynamics® GP 2010 Programmer’s Guide

Also online: Architecture from msdn

Fix: Dynamics GP 2010 modify word template, File Not Found

 

Template maintenance in Dynamics GP2010 fails

When in REPORTS>>Template Maintenance, after creating a new report from an original report, clicking on “Modify” caused a file not found exception on our install of GP.

"File Not Found: C:\DOCUME~1\USERXX\LOCAL~1\TEMP\file you were savingcreating.docx"

Solutions on the web GP community forums

  • Reinstalling Dexterity Shared Components
  • Upgrading to GP2010 SP2 or above

These solutions were not working for us. Between us we spent too much time running filemon and looking at debugger tool traces trying to track the problem down. The traces showed the template being created in the user profile temp directory with no error, but in reality it never got there.

Breakthrough

The server copy did work correctly. We spent some time between us trying to work out what the issue was and finally a colleague said something that made sense to me, so I checked out the theory.

I did a WinMerge check between the Add-in Directories (Addins subdirectory of GP application directory) on the working and failing machine and found the following missing files:

image

 

Copy the missing DLLs into the Adds folder

After copying all but the BusinessIntelligence dlls to the add-in folder of the previously broken install, the feature started working correctly again.

My guess is the managed storage dll is involved with the creating of the temp file… possibly.

Hence it would seem we’ve dropped these files as we have upgraded through the versions. We have our own Visual Studio Tools Addins in the add-ins folder. These are passed from version to version as we upgrade GP. My guess is these extra missing dlls got lost at some point causing the word template editing functionality to fail.

I hope this post has helped you get to the solution more quickly that we did.

Here is the working template in word

clip_image002