Integrating Customer Maintenance and Letter Writing with Microsoft Outlook

I love a challenge when I see one, but more important, I love to share my knowledge when I get to the bottom of it all. On the Microsoft Dynamics GP Newsgroup a user expressed her interest in seeing more integration between GP's letter writing capabilities and Microsoft Outlook as it relates to Customers and Vendors. While one could argue that you could use already built-in email submission capabilities in Microsoft Word to send documents from there, the fact remains, that all the customer internet information would be ignored, forcing the user to switch between Outlook and GP to retrieve and manually enter email contact information into Outlook and perhaps even having to click through mounts of directories for files just previously saved with the Letter Writing Assistant.

Implementation

1) With the Customer Maintenance window open, press CTRL+F10 to open Modifier.

2) Move the INet1 and INet2 fields to the window area on the Customer Maintenance window. Do not be concerned about the placement of the field since later on they will be moved back to their original positions.


RM_Customer_Maintenance window as seen in Modifier

NOTE: This customization re-uses the INet1 and INet2 fields available to support Small Business Manager functionality.

3) Save the changes and return to GP (File > Microsoft Dynamics GP).

4) Grant security to the modified window:

· In v10: Microsoft Dynamics GP > Tools > Setup > System > Alternate/Modified Forms and Reports.

· In v9: Use Advanced Security or the Security options to grant security to the modified window.

5) Open the Customer Maintenance window and add the form to Visual Basic. Press CTRL+F11 on your keyboard.

6) Add fields to Visual Basic. Press Shift+F11 to activate the visual cue. Click on the following fields: INet1, INet2, Customer Number, Write Letters button

7) Open the Visual Basic editor, locate the Microsoft Dynamics GP Objects in the Project Explorer pane, and double-click on the CustomerMaintenance (Window) object.

8) Download and paste the following code in the Code Editor.

WARNING: This customization uses a method of executing Dexterity sanScript code from VBA which is unsupported by Microsoft.

9) From the menu bar, choose Tools | References. Mark the following references: Dynamics Continuum Integration LibraryMicrosoft Outlook 1x.0 Object Library

Click Ok to continue.

10) From the Debug menu, choose Compile Microsoft_Dynamics_GP.

11) Save the project and close the Visual Basic Editor.

12) From the Customer Maintenance window’s Tools menu, select Customize, then choose Modify Current Window, or press CTRL+F10 on your keyboard.

13) Move the INet1 and INet2 fields back to their original position.

14) Save changes and return to GP.

15) Open the Customer Maintenance window and click on the Write Letters button drop-down list. You will now see the new "Send an Email" option. You will need to select a customer first to continue.



By default, the customization will open the directory specified for Letters in the DEX.INI file.

Techniques Demonstrated

1. Working with Microsoft Outlook via COM Automation. There are six main steps to sending a Microsoft Outlook mail message by using Automation, as follows:

a) Initialize the Outlook session
b) Create a new message
c) Add the recipients (To, CC, and BCC) and resolve their names
d) Set valid properties, such as the Subject, Body, and Importance
e) Add attachments (if any)
f) Display/Send the message.

Outlook Automation has remained virtually unchanged since Outlook 2000, but you can refer to Microsoft KB article 220595 for more information on the subject.

2. Pass-thru sanScript implemented with Dynamics Continuum Integration Library, to add an item to the letter writing Button Drop-Down List control (for more information on how to dynamically populate a list control read David Musgrave's article on the subject).

Pass-thru sanScript is also used to call the RW_GetInternetInfo function to retrieve customer email address and to read the Letters Path key from DEX.INI file which will in turn serve as a default directory for the attachment dialog.

3. Use of the Common Dialog Box API to return the path to the email attachment. Please refer to my previous article on Using the Win32 Common Dialog Box API to return a file path to a Dynamics GP modified form field as it explains in great detail the use of this API.

Downloads

You can always download the package files and import using the Customization Maintenance window under Microsoft Dynamics GP > Tools > Customize > Customization Maintenance. Don't forget to include your references as indicated in step 9 above.

Dynamics GP 9.0 package file - Click here
Dynamics GP 10.0 package file - Click here

Once again, I have demonstrated the power of Visual Basic for Applications in Microsoft Dynamics GP and how you can achieve high degrees of integration with the inner works of the system itself and with other desktop applications like Outlook, and even the Windows operating system elements. As usual, please drop me a note if you have any comments on this article or if you would like to see a particular topic discussed on this site.

UPDATE:

When choosing references to the Microsoft Outlook Object Library, consider the active version of Outlook you are currently using. The following is a summary of Object Library versions related to their corresponding version of Microsoft Outlook.

Microsoft Outlook 2007 --- Microsoft Outlook 12.0 Object Library
Microsoft Outlook 2003 --- Microsoft Outlook 11.0 Object Library
Microsoft Outlook XP --- Microsoft Outlook 10.0 Object Library

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/

Comments

Anonymous said…
Hi,

Can you please let me know how can I add a custom window to Employer Maintenance window. I have gone through the forms list in the DynamicsDictionary but could not find a right form. What I need is to open a custom window after I open employee maintenance window?

Thanks in advance,
Triven
Mariano Gomez said…
Triven,

Thanks for your question. This will depend how you created your custom window. If it's a Dexterity based window, you can always use the examples contained in the Integration Guide (IG.PDF) provided with Dexterity.

If your custom window is a Visual Basic for Applications form, you are better off looking at one of my newest post on the subject at http://dynamicsgpblogster.blogspot.com/2008/10/using-menus-for-visual-studio-tools.html. In this post, I use the newly released Menus for Visual Studio Tools to add a custom form built with VBA.

If this still does not answer your question, please feel free to post back.

Best regards,

MG.-
Mariano Gomez, MIS, MVP, MCP, PMP
http://www.maximumglobalbusiness.com
Anonymous said…
Mariano,

I understand this is quite old but I was wondering if this can be used in GP 2010.

Thanks!
Mariano Gomez said…
@Anonymous:
The above is still applicable to GP 2010.

Thanks,

MG.-

Popular posts from this blog

DBMS: 12 Microsoft Dynamics GP: 0 error when updating to Microsoft Dynamics GP 2013 R2

Do I have to use those "Z-" currency IDs in GP?

Microsoft Dynamics GP Scrolling Windows and Line Sequence Numbers