“Copy” any field from any Dynamics GP window using Dexterity SDK

I usually spend maybe 30-60 minutes Google-ing something before I just give up and write code to do it. For all I know there is a better way to go about this but this is my approach. In the famous words of James May, I would classify this as “an ingenious solution to a problem that should never have existed in the first place” (RIP Top Gear).

I have always wondered why you couldn’t select data in windows in Dynamics GP. Theft? Because that would make life too easy and we have to make sure there is still enough work for accounting technicians to do at the end of the day before robots take over? Regardless I wrote a short C# procedure that grabs the current window and dumps all non-empty fields into a nice data grid view that IS copyable. Needless to say this does not output data in scrolling windows as that is a separate window from the main window (although just as easy to copy from). As this is written as an add-in, you have to add the menu handler to each window you would like this on, but because I love coding in a very universal matter, no extra parameters or changes are required when calling the procedure from a new window.

Now for the code walkthrough (complete code provided below):

Grab the current window

static void displayDetails(object sender, EventArgs e){
Microsoft.Dexterity.Bridge.DictionaryForm currForm = sender as Microsoft.Dexterity.Bridge.DictionaryForm;

When you call a procedure from any window in GP, the SDK sends the reference to that form through the sender object

Create our data table

DataTable dt = new DataTable();
dt.Columns.Add(“Name”, typeof(String));
dt.Columns.Add(“Value”, typeof(String));

Loop through each field in the window

foreach (var field in currForm.Windows[0].Fields)

I left the index at 0 because for the most part I am just interested in the main window which is *usually* 0. You could add a form name check here to see if it matches the sender’s name to check for the main window to make this more robust

Loop through each property in the field hunting for the Name and Value

foreach (var prop in field.GetType().GetProperties()){
switch (prop.Name){
case “Name”:
name = prop.GetValue(field, null).ToString();
break;
case “Value”:
value = prop.GetValue(field, null).ToString();
break; } }

Save the results to the data table

if ((name != “”) && !(String.IsNullOrEmpty(value))) {
DataRow row = dt.NewRow();
row[“Name”] = name;
row[“Value”] = value;
dt.Rows.Add(row); }

The only “hard-coded” aspects of this code are the property values “Name” and “Value” which I think is fairly safe to say are not going to change anytime soon. I created a form that stores my datagridview and bind the data table to that view. I also set the shortcut to close the form to CTRL-Q (same shortcut used to execute the code). This allows the user to quickly open and close it using the same shortcut. The other benefit of being a separate form is that you can navigate away from the original form but leave the Details_Form open for reference. I did not provide a .dll as it is up to you what windows you want to add this to but if there is anyone who wants me to build it based on a list of windows, comment below.

Code: Display Details.txt

Screenshot (blanked out sensitive information):

displayDetails

Enjoy,

~James

Disclaimer: I am very much an amateur programmer. I have never taken an official Microsoft course. I cannot guarantee any code/program that I provide as I only have the ability to test my work on a small sample set. Users accept all the risk of using anything I provide and are encouraged to thoroughly test in a dedicated test environment before moving to production. Files I provide are free for use and are not to be resold. By using my files you agree to not hold me liable for any damages caused by said files.

GP Batch Attach Payables Documents

Last up for now is my Batch Attach add-in. We tend to use Integration Manager at work to upload lots of invoices. In this day and age, there has been a push to move everything electronic and stop wasting so much paper. The new document attach feature was great addition over the old OLE notes which made attaching documents much easier and more intuitive. Unfortunately manually attaching 100+ PDF invoices every week is cumbersome.

There is where I stepped in. Using a vendor ID and document number, I navigate to the payables transaction zoom window and essentially use my Quick Attach code to attach the file that you designate. Since this is all done via Sanscript/Continuum this all happens in milliseconds so looping this through 100+ invoices takes seconds.

I read information from the Clipboard so the information that needs to be copied from Excel or any Tab-delimited file is Vendor ID, Document Number, and the file path of the document.

GPBatchAttach(Template)

GPBatchAttach(PM)

Before the attach process starts, I verify that the document number provided exists for that vendor and that the file path provided is accessible.

GPBatchAttach(Form)

A confirmation window will appear displaying the number of successfully attached documents.

GPBatchAttach(Confirmation)

Note: There is a function I used in Continuum that I was not 100% of the last parameter. I have verified that it works on our installation of GP but as I said before, I have no ability to test on a different configuration.

Prerequisite: At least 2013 R2 must be installed as this uses the new Document Attach module not the old OLE notes version.

Installation: Copy the dll into the Add-ins folder in your Microsoft Dynamics GP installation directory

Use: Batch Attach currently only works with the Payables module. It can be accessed from the following windows from the Additional menu on the toolbar if installed properly:

  • Payables Transaction Inquiry – Vendor
  • Payables Transaction Inquiry – Document

Download: GPBatchAttach.dll (Version 1.0.5578.19243)

Sample template: Batch Attach Template.xlsx

Enjoy,

~James

Disclaimer: I am very much an amateur programmer. I have never taken an official Microsoft course. I cannot guarantee any code/program that I provide as I only have the ability to test my work on a small sample set. Users accept all the risk of using anything I provide and are encouraged to thoroughly test in a dedicated test environment before moving to production. Files I provide are free for use and are not to be resold. By using my files you agree to not hold me liable for any damages caused by said files.

GP Quick Attach

Next up for release is my “Quick Attach” feature. This was simply driven by laziness as people disliked having to open up so many windows just to attach one document. This adds the attach feature to the window you are currently working in.

Prerequisites: This assumes you are on at least 2013 R2 and are using the new Document Attach feature rather than the old OLE notes version. The new version stores the actual files in the SQL database rather than references a shared folder.

Installation: Copy the dll into your Microsoft Dynamics Installation folder’s Add-in folder. Restart GP

Use: Quick attach can be accessed from the following windows using the “Additional” menu that should appear on the toolbar if properly installed.

  • GL Transaction Entry
  • GL Journal Entry Inquiry
  • Payables Transaction Entry
  • Payables Transaction Entry Zoom
  • Sales Entry
  • Sales Inquiry

QuickAttach

Download: GPQuickAttach.dll (Version 1.0.5578.18959)

The way I coded the add-in makes it extremely easy to add to a new window. For me, it just takes one line of code to add quick attach to a new window so if others want it on other windows, comment below and I’ll try to update it.

Enjoy,
~James

Disclaimer: I am very much an amateur programmer. I have never taken an official Microsoft course. I cannot guarantee any code/program that I provide as I only have the ability to test my work on a small sample set. Users accept all the risk of using anything I provide and are encouraged to thoroughly test in a dedicated test environment before moving to production. Files I provide are free for use and are not to be resold. By using my files you agree to not hold me liable for any damages caused by said files.

GP Paste From Excel With Intercompany

As mentioned before, here is my add-in for Microsoft Dynamics GP. The version I use it with is 2013 R2 but I have no reason to believe that it would not work for older or newer versions of GP. While developing it, I made sure to make it conform to the same format as GP’s built-in Paste feature so the order of the columns is typically Description, Account, Debit and Credit. For Intercompany, the company ID is required and for Payables or Sales, the document type is needed. The dll reads the data stored in your Clipboard in the order shown in the examples so you just need to copy data from Excel or any Tab-delimited file.

Installation: Drop the dll into your Microsoft Dynamics installation folder’s Add-In folder and restart GP.

“Paste Entry” is accessible from the “Additional” toolbar at the top of the following windows:
– GL Transaction Entry
– Payables Transaction Entry (Distribution Window)
– Sales Transaction Entry (Distribution Window)

GPPaste(PM) GPPaste(RM) GPPaste(GL)

Features Supported:
– Intercompany
– Multicurrency (values are entered as Originating amounts)

Download: GPPaste.dll (Version 1.0.5578.19478)

Copy template: Paste GL Transaction Example.xlsx

GPPaste(Template)

Enjoy,
~James

Disclaimer: I am very much an amateur programmer. I have never taken an official Microsoft course. I cannot guarantee any code/program that I provide as I only have the ability to test my work on a small sample set. Users accept all the risk of using anything I provide and are encouraged to thoroughly test in a dedicated test environment before moving to production. Files I provide are free for use and are not to be resold. By using my files you agree to not hold me liable for any damages caused by said files.

Hello world!

I would consider this my first leap into the world of blogging. I am planning to use this as a platform to share my development work with others. Over the past few weeks I have taught myself the Microsoft Dynamics GP SDK to fill the gaps that 2013 R2 has for my employer. After having nothing but glowing responses about how much easier I made everyone’s lives, I decided that I wanted to share my work to others for free.

Features that I have developed and plan to release in the near future:

Paste Distribution:
Anyone who has worked with 2013 R2 has probably quickly learnt the limitations of the built-in Paste button. It ONLY works for non-intercompany general journal entries. After finding and reading Mohammad R. Daoud’s post: Practical Example on Dynamics Continuum Integration Library: GL Transaction Entry Integration I managed to easily expand out the paste abilities. I have added paste to the following windows:

-Payables Transaction Entry
-Sales Transaction Entry
-Financial Transaction Entry

Multi-currency and Intercompany are supported for all windows listed and since I use Sanscript/Continuum to fill the fields, GP still validates all information that gets entered (i.e. Checks if account exists).

Quick Attach:

I am a very lazy person. If I can find a way to reduce the steps I need to take by even one step, I will write code to do just that. With Document Attach 2.0 that was introduced with R2, more coworkers are finally starting to attach files to items in GP. Typically that involves clicking on the piece of paper icon which brings up the OLE note window, then clicking on the paper clip, clicking on attach, selecting your file, and closing back out until you are back at your original screen. Instead, I have written code that is accessible from the toolbar that directly opens an Open File Dialog window and attaches the file you select, all from the current window.

Batch Attach:

Integration Manager for Dynamics GP allows accounting technicians to batch upload invoices into GP. What happens when you then tell that technician he/she needs to attach the PDF of the invoice for all 50 invoices he/she just integrated? Complaints is what. Recycling a lot of the code I used for Quick Attach, I wrote a procedure that takes in Vendor IDs, Document Numbers, and the file paths as parameters and navigates to the document numbers and attaches the files given. This makes attaching 30 PDFs to 30 different invoices a couple second process.

I hope to have my code ready for public release soon so stay tuned. In the meantime, if anyone has a suggestion or idea for a future feature, please do not hesitate to comment or message me and I will see what is possible.

~James

Disclaimer: I am very much an amateur programmer. I have never taken an official Microsoft course. I cannot guarantee any code/program that I provide as I only have the ability to test my work on a small sample set. Users accept all the risk of using anything I provide and are encouraged to thoroughly test in a dedicated test environment before moving to production. Files I provide are free for use and are not to be resold. By using my files you agree to not hold me liable for any damages caused by said files.