Microsoft Product Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label Word Templates. Show all posts
Showing posts with label Word Templates. Show all posts

Monday, 18 November 2013

How to Display Parent Company Information on SOP documents

Posted on 02:00 by Unknown
A few days aback I encountered a really interesting discussion on the Microsoft Dynamics GP Community forum where the user needed to get the parent customer information on the SOP Blank Invoice Form. I asked myself, "Well, how difficult can that be?"

The first thought around these requests is, you create a table relationship between the Sales Transaction Work (SOP_HDR_WORK) table and the RM Customer Master (RM_Customer_MSTR) table by Customer Number and you get the parent customer ID. In that train of thought you immediately realize that there's no way to alias the RM Customer Master table back into the table relationship to retrieve the parent customer ID information. [NOTE TO SELF: this would be a cool Report Writer feature, but I digress.]

Of course, a second alternative is to use VBA, but many customers and partners are wary of implementing a VBA solution, especially when they are considering upgrading to Microsoft Dynamics GP 2013 and taking advantage of the web client. VBA customizations simply do not work with the web client.

As I thought through an alternative, I quickly realized this would be a good fit for the Support Debugging Tool and it's awesome Runtime Execute feature. As it turns out, the Support Debugging Tool is capable of executing Dexterity sanScript code within the context of any dictionary, but not only that; it provides some really cool templates that save time and minimizes the amount of code an entry level developer needs to create to accomplish a solution. In turn, there are a number of Report Writer API scripts built into the Dynamics application dictionary (DYNAMICS.DIC) to allow third party developers to expose data from their tables onto an existing Microsoft Dynamics GP report without having to write a complex interface to do so.

The Solution

1. The first task at hand is to open the Runtime Execute window in the Support Debugging Tool. Once the window is open, click on the Helper button to open the Insert Helper Function window. From the drop-down list, select template for rw_TableHeaderString.

Insert Helper Function window

Below is the signature for the function as we will use it.

The rw_TableHeaderString function

function returns string sData;

in integer dict_id; {Support Debugging Tool Dictionary ID}
in string report_name; {Support Debugging Tool Script ID to call}
in string sNumber; {Parent Customer ID field we will retrieve}
in integer sType; {Not used, we will default to 0}
in integer iControl; {which piece of data to return}

We will use this function to return a string value for the selected Parent Customer ID information field to a Report Writer calculated field.

By clicking OK, the Support Debugging Tool inserts the code to get us started in the right direction.

Helper Code
Very cool! All that's left now is to add the extra bits of code to retrieve the parent customer information from the RM Customer Master. In addition, we need to make sure that this code executes in the context of the Microsoft Dynamics GP product.

Additional Code
The template function even indicates where our code should be inserted and as you can see this is easy stuff for any entry level Dex developer. All we did here was use the MBS_Number local field as the parameter value that will contain our parent customer ID (to be passed from Report Writer) to get the piece of data we are interested in based on the value that we will supply to the MBS_Control local field (again, from Report Writer). The returned table value will then be stored in the MBS_TableHeaderString local field.

The Support Debugging Tool then goes to action and call its MBS_Param_Set API function to talk back to the Report Writer API script and deliver the values retrieved to it. Isn't this awesome!

2. The second part of our solution consists of 3 parts really: a) we need to create a table relationship between the Sales Transaction Work table and the RM Customer Master table as this relationship does not exist out of the box, b) We then need to create calculated fields for the pieces of Parent Customer data we would like to retrieve, and c) We need to complete the layout and grant security to the modified report.

I will assume for this article that you are familiar with the processes of creating new table relationships in Report Writer and laying out the new calculated fields and granting security to the modified report. You can always browse the Report Writer manual accompanying your Microsoft Dynamics GP application for information of these processes, so my attention will focus solely on the calculated field.

In this example, I want to retrieve the parent customer name. For this we will create a new calculated field as follows:

a) Create a new calculated field, in this case I will call it (A) Parent Name. The result type of the calculation will be a String and the expression type is Calculated.

b) Since we are using the rw_TableHeaderString user-defined function, we will choose this accordingly:

rw_TableHeaderString

c) Now we have to setup the parameters as indicated by the function signature above. The first parameter we will add is the Support Debugging Tool's dictionary ID, 5261. We will add this as an integer constant.

Dictionary constant 5261 to call the script we wrote
d) Now we have to call the Runtime Execute script we created, GETPARENTINFO. We will add this as a string constant.

GETPARENTINFO

e) We now need to pass the parent customer number parameter, our default (not used) parameter, and the value number for the field that will be retrieved for the parent customer data, according to how we coded our script above. This is shown below.

Last 3 parameters.

The RM_Customer_MSTR.Corporate Customer Number field is retrieved from the RM Customer Master table which we created via a new table relationship and subsequently adding that table relationship to our report.

The following shows a muck-up of the report layout with the parent customer name calculated field created:

Report Layout
The report should display something like this when run in Microsoft Dynamics GP:

Invoice Layout


Final Notes

The above script could be extended to retrieve other pieces of data for our parent customer, like contact, address, city, state, zip, phone numbers, etc. In this case you will need to add more entries to the case...end case statement above and retrieve the correct table column. You can find more information on the table columns for the RM Customer Master in the Microsoft Dynamics GP software development kit (SDK).

This solution is absolutely compatible with Word Templates and the Web Client. In the case of Word Templates, you will need to export a new report definition file (XML) and import into your template fields. In the case of the Web Client, all the components above are within the confines of a Dexterity application and the Support Debugging Tool happens to be compatible with the Web Client, just as much as Report Writer is. Your modified report should render absolutely fine on the Silverlight canvas control, if printing the standard report.

For all workstations to take advantage of the Runtime Execute script, the Support Debugging Tool must be deployed with the recommended configuration - all workstations pointing to a centralized configuration file, debugger.xml.


The Support Debugging Tool never ceases to amaze me. You can find similar article to this one and more information here:

The Dynamics GP Blogster - Adding Customer Item User Defined Field to SOP Invoice
Developing for Dynamics GP - The Support Debugging Tool Portal

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Code, Dexterity, Dynamics GP 2010, Dynamics GP 2013, Report Writer, Support Debugging Tool, Web Client, Word Templates | No comments

Monday, 31 December 2012

The Dynamics GP Blogster's best articles of 2012

Posted on 10:29 by Unknown
It's that time of the year again! Time to say goodbye to the outgoing year, 2012, and receive the new one, 2013, making all sort of resolutions that we never seem to be able to achieve and with good measure, since most of us are simply consumed with the daily grind that lifting our heads up to take a breather and see the forest from the trees seems difficult and sometimes downright impossible.

2012 however was a very good year and gave me tons of stuff to write about. In retrospect, 3 conferences, 2 virtual conferences, the release of Microsoft Dynamics GP 2013 and the Web Client are simply a subset of the activities that allowed me to write some really cool stuff that you expressed through your comments to enjoy. Without further due, here is a list of the "best articles of 2012" written on this site (in no particular order):

1. Microsoft Dynamics Convergence 2012 Houston. Convergence Houston in March of 2012 was a very cool experience and probably one that I will never forget as I was able to meet up with my good friend David Musgrave and his wife, Jennifer. I also had the opportunity to share some time with some of my customers in attendance. As always, the good part is meeting tons of people and the thrill of presenting.

2. Microsoft Dynamics GP Technical Airlift 2012. In the realm of cool, the Technical Airlift in Fargo, North Dakota was a very awesome conference, but also marked the first time I presented without my compadre, David Musgrave. The Tech Airlift also demanded tons of prep work and was built upon cooperation between Microsoft and GPUG's GPPC and featured a record number of partners in attendance. I also liked the fact that I met up with some of my fellow MVPs.

3. GPUG Summit 2012 Seattle. Seattle has this aroma of coffee mixed with sea all over the city and I have to say the GPUG summit was a very charming conference, with lots of topics for the attending crowd. Seattle, Seattle...

4. Windows 8 and the Microsoft Dynamics GP Web Client Series. Okay, so I confess. I was a nuisance to the Escalation Engineering team testing the Web Client. You see, the Web Client was not supposed to even be working on Windows 8 as a compatible installation platform, but after months of annoying I had my way with this. The best part though was working with the team of Aaron Donat and Jason Lech and understanding the nuances of the deployment process of GP Web Client. Thanks guys for putting up with me and for making this happen.

5. Adding Customer Item User Defined fields to SOP Invoice. I love the Support Debugging Tool and how it can make live easier for things that seem unconceivable. How about this cool article on getting customer item user defined fields onto the SOP invoice? Well, I have to say I had tons of fun getting this to work.

6. How to add a "Cover Letter" page to a Microsoft Dynamics GP Word Template document. Life is not complete without a Word Template article. I hope to keep these coming in 2013 since Word Templates are essential to Web Client.

7. Resizing SmartList panes with the Support Debugging Tool. Now, did I say I love the Support Debugging Tool? David Musgrave leverages some obscure Dex functions to make SmartList a dream tool to use.

8. Leveraging Custom Links to track carrier shipments in Sales Order Processing. You know, I am always amazed at how underutilized GP seems to be sometimes, but my duty as a blogger and consultant is to expose these underutilized features to the community.

9. Microsoft Dynamics GP Add-In for Microsoft Word not enabling despite several attempts to install. I had a number of clients come to me with this issue. Upon doing more research, I realized it was a community wide problem and I had to do something about it.

10. Adding more comment lines to POP Purchase Orders. Building on a previous article written by David Musgrave for SOP, I thought I would show how to accomplish the same in POP - it was all worth it as the community gave praises for the solution.

101 articles throughout the year are simple quite a bit of stuff written. I just hope I can keep the good stuff coming. Happy New Year!

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Best of Series, Convergence, Events, Purchasing, Sales Order Processing, Support Debugging Tool, Technical Conference, Word Templates | No comments

Sunday, 26 August 2012

How to add a "Cover Letter" page to a Microsoft Dynamics GP Word Template document

Posted on 20:44 by Unknown
I wrote an article almost a year ago showing a simple technique to add a Terms and Conditions page to a Microsoft Dynamics GP Word Template document. You can read more about this here:

How to add a "Terms and Conditions" page to a Microsoft Dynamics GP Word Template document

Just recently, I received a comment on the article, where the poster was asking how to use the same techniques outlined to add a Cover Page to an invoice document, so I figure, after playing with the idea for a bit, that I would post the steps to accomplish this too.

All steps - up to step 3 - are the same, except, you probably would want to give this template an appropriate name. I will continue with step 4 as it applies to this article.

4. Position your cursor immediately above the company address information and add 2 single line tables. Add one table first, then create additional separation with the company information by pressing enter on your keyboard a couple times. Move up a line or so, and add another singly line table as shown below.

2 single line tables added
5. In the first single line table, add your Cover Page content.

Content added to the first single line table
6. Highlight the second single line table, then click on the Paragraph expansion button under the Home ribbon to open the options window. Click on the Line and Page Breaks tab and mark the Page Breaks Before check mark. Click Ok to continue.

Paragraph options for Page Break
7. This will now have the desired effect, by sending the first table with the Cover Page content to the first page of the document.

Cover page plus invoice page

8. The rest are some cosmetics... you can highlight each table and chose to remove the borders from each, which will give your document the look you are hoping to achieve.

Word Templates are always fun to play around with, especially because every single piece of information must be displayed within a content control - in this case a table. So it makes for some cool puzzles.

If you have resolved this same problem in a different way, I would love to hear from you. Please add your comments to this article. Also, keep in mind that I have tested this with limited data, so there's always a chance something might not work.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Sales Order Processing, Word Templates | No comments

Thursday, 2 February 2012

Debugging Microsoft Dynamics GP Word Templates Revisited

Posted on 04:51 by Unknown
Couple days aback, I went through an issue were Microsoft Word templates were being rendered to an html file, causing Internet Explorer to launch instead - see Word Templates rendering report in Internet Explorer. In troubleshooting this problem, I engaged my good friend Rob Wagner over at Microsoft, who showed me a few more tricks for troubleshooting issues around Word Templates and template rendering.

Also, some time ago I covered a troubleshooting tip in my article Debugging Microsoft Dynamics GP 2010 Word Templates. Back then I looked at the TPELogging Dex.ini key, which creates a log file in the temp folder (%temp%) where templates are rendered and loaded by Microsoft Word. TPELogging is used to establish where possible exceptions could have occur while rendering the actual template into a Word document.

While working with Rob, I learned about another Dex.ini key that can assist with the troubleshooting process:

KeepTemplateTempFiles=TRUE

This Dex.ini key allows Dexterity to persists the template in the temp folder once the Microsoft Word document has been created. Now, to see how this is useful, you need to keep in mind a few things about how Word Templates really works in Microsoft Dynamics GP.

When a template is created under the Report Template Maintenance window, the actual template XML representation is saved in the system database, DYNAMICS, in the syReportTemplates table (in a SQL Server binary data type column). This is all good, because in theory, once you create your template and saved it away from the temp folder into, say, My Documents, then reimport that template into Microsoft Dynamics GP, there will never be a chance of you loosing the changes you made even if you delete the physical template document (the DOCX).

With that said, when you print a template 3 things happen - well, to summarize anyways:

1. The Report Writer engine generates an XML data file if the report was setup to use a template.

2. The Word Template code takes over and reads the actual XML template representation in syReportTemplates, and recreates the physical Microsoft Word template document in your local temp folder.

3. Through Microsoft Word and Open XML automation, the physical template is applied to the XML data file to create the final Microsoft Word document, this is, your invoice, purchase order, or any other document you have decided to generate using a template.

When the final document is delivered, the code performs some cleanup by removing the template file (leaving you with the actual output document).

The KeepTemplateTempFiles key allows the Word Templates code to persist the generated template (in step 2 above). Should you run into any issues, you could potentially open the template file to compare against the document you originally worked on.

A couple words of caution...

If you choose to enable KeepTemplateTempFiles, be sure to disable it once you have completed all troubleshooting activities, since each time you print a document to a template, you will obtain a new template file for that print run. Overtime, you can have a very full temp folder should you not set the key value to FALSE. By default, Microsoft Dynamics GP has this key value turned off when it's not found in the Dex.ini file.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in DEX.INI, Troubleshooting, Word Templates | No comments

Tuesday, 31 January 2012

Word Templates rendering report in Internet Explorer

Posted on 15:09 by Unknown
I have been working on a Word Templates case for the past 2 weeks and just got to the bottom of the problem, hence I felt the need to pause and blog about it.

Background

A client of mine reported a couple weeks aback that they had created a template version of their purchase order and each time the purchasing staff attempted to print a purchase order, the output would automatically generate in Internet Explorer instead of Microsoft Word. As the title of this article suggests, the client is using Word Templates to generate a nice looking PO for their vendors.

HTML POP Purchase Order Blank Form


However, and to make matters more interesting, when they printed a standard sales invoice, SOP Blank Invoice Form, these would generate just fine in Microsoft Word.

Troubleshooting

In troubleshooting this process, we went through all the formal setup and steps to create a template in Microsoft Dynamics GP, with the added benefit that the client's purchase order form was not a modified report. I also outruled the Word Add-On for Microsoft Dynamics GP being an issue, since the sales invoices were being created just fine.

I made sure the client was not accidentally selecting HTML as the default output. As previously mentioned, when the purchase order was printed, it would automatically go to Internet Explorer. We also selected a File output and the Microsoft Word file would automatically get an html extension following the docx; for example, POP Purchase Order Blank Form.docx.html.

Printing Purchase Order Document
When printing the purchase order, one thing stood out in the printing process... the Report Type drop-down list would automatically default to Standard -- not to Template as would be expected -- and the client would have to manually select Template before clicking Ok to print. Not so, when printing sales invoices.

We also checked the REPORTS.DIC dictionary file, by accessing Report Writer, to ensure the purchase order report was not modified. Effectively, this was not the case. Puzzled by this situation, I called my good friend Rob Wagner over at Microsoft and explained what was going on. In formulating an approach to address the issue, Rob added a key to the Dex.ini - more on this tomorrow - that would allow him to debug what was happening when the template was generated.

To Rob's surprise, adding the Dex.ini key had no effect nor did it produce the debug file he was expecting. Then, the magical question came up... "Does you client have any third party products or add-ons installed that affect the POP module?" and the answer... "Yes, Project Accounting". This is when it all became clear to both of us where this was going.

As it turned out, the client is also using Project Accounting. However, the user entering the POs has no access to the Purchase Order Entry alternate window - hence was seeing the standard Microsoft Dynamics GP Purchase Order Entry window. However, according to security settings, the user had access to the alternate POP Purchase Order Blank Form report.

Access to alternate version of POP Purchase Order Blank Form

When the user prints the PO from the standard Purchase Order Entry window, GP would attempt to print the Project Accounting alternate purchase order report, but could not find a corresponding template.

Rob proceeded to explain that this behavior was by design. In essence, when a template cannot be found for an alternate version of an original Microsoft Dynamics GP report, the Dexterity code behind the Word Template functionality, will automatically render the report to HTML. Since html files are usually tied to Internet Explorer, this would cause that application to launch automatically.

The first tell-tell sign of a problem as described above lies in the Report Destination window defaulting the Report Type drop-down list to Standard, even though a template "exists" for the report being printed. In reality, the template you are seeing in Report Template Maintenance is the core Microsoft Dynamics GP report template and not the template for the alternate dictionary, in this case Project Accounting.

Solution

If using a third party product or add-on that contains an alternate versions of a core Microsoft Dynamics GP report, you will need to ensure that the template that is created corresponds to that dictionary or remove security to the alternate report.



However, and as luck would have it, I could not create a new template based on the existing POP Purchase Order Blank Form in the Microsoft Dynamics GP dictionary, because the two reports use a slighly different data set - the PA alternate report uses additional fields and tables not used by the standard report - but that's a tale for another time. In the mean time, I hope you find this article useful.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Project Accounting, Purchasing, Report Writer, Troubleshooting, Word Templates | No comments

Tuesday, 10 January 2012

Microsoft Dynamics GP Add-In for Microsoft Word not enabling despite several attempts to install

Posted on 05:16 by Unknown
Just recently, I ran into a situation with the Microsoft Dynamics GP Add-In for Microsoft Word where, after following all the installation steps and on-screen prompts, I could not get the Microsoft Dynamics GP Templates section to show up under the Developer's ribbon in Microsoft Word 2010.

Microsoft Dynamics GP Add-In for Microsoft Word properly registered in Microsoft Word


Microsoft Dynamics GP Add-In for Microsoft Word not registered in Microsoft Word

The customer was also running a 32-bit version of Microsoft Office, clearly indicating that the issue was not related to the version of the Office product being ran - Word Templates are still not fully compatible with 64-bit Office platforms.

A first troubleshooting step under these circumstances is to make sure that the Microsoft Dynamics GP Add-In for Microsoft Word is enabled under the COM Add-Ins window in Microsoft Word. You can access the COM Add-Ins window by clicking on the button of the same name on the Developer's ribbon - please refer to the first picture above.

COM Add-Ins window
When I highlighted the Microsoft Dynamics GP Add-in for Microsoft Word component, the Load Behavior indicated Not Loaded. A runtime error occurred during the loading of the COM Add-in. While this was not a good thing, it was also a good thing, since it provided me with a key piece of information: the add-in was effectively installed, just not loading/enabling for some reason. This brought the attempts to reinstall and repair to a halt which was a good thing.

So now, I needed to figure out why the add-in wasn't loading. I figured in this case it would be appropriate to fire up my good old friend Process Monitor (ProcMon) to get a glimpse into what was going on.

After (a good 2 hours!) running some traces by attaching ProcMon to the WINWORD.EXE process, I noticed that each time I launched Microsoft Word, it would try to find the Microsoft.Office.Tools.Word.dll assembly when attempting to register the the GP add-in for Word. That was the proverbial light at the end of the tunnel! In doing some additional research, that assembly is an integral part of the Microsoft Visual Studio Tools for Office (VSTO) Runtime. The version for Office 2010 is VSTO 4.0.

You can download VSTO 4.0 from the Microsoft Download Center.

For more information on VSTO 4.0 click here.

Hopefully this saves you a lot of frustrations.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Troubleshooting, Word Templates | No comments

Thursday, 17 November 2011

Codename GP "12" Preliminary Features Series - 1 of 4

Posted on 04:00 by Unknown
Codename GP "12" Preliminary Features - Part 1 

This is article is part 1 of 4 from the series Codename GP "12" Preliminary Features. Some images and content reproduced with express permission from Microsoft Business Solutions, a division of Microsoft Corporation.

DISCLAIMER: These features are subject to change.


I am only repeating what I have heard so please don't shoot the messenger. With GP "12" to be released "sometimes next year" - and yes, December 31, 2012 is still within that time frame - there may still be features on the following list that may not make the cut. However, it was fairly clear that the boys and girls on the Microsoft Dynamics GP development team in Fargo are working their rears off to get the feature list to a state where they feel pretty comfortable, meeting the demands on the shopping list.

Straight out of GPUG Summit's closing session, comes some of the top features being worked on, based on the traditional 4 pillar goals:

4 Core Design Pillars
Each pillar allows the engineering team to showcase a list of features that will support the objectives behind pillar.

Simplicity
The PM Reprint Check Remittance, for instance, will allow users to re-print the check remittance without having to generate the check.

Improvements have also been considered for the FA Calendar Setup feature. In this case, the Fixed Assets calendar does not have to match the fiscal calendar. You can now have multiple calendars, for example, having an asset depreciate on a fiscal year for tax purposes, if tax year and fiscal year are different, and depreciate calendar year for financial reporting purposes.
  
The Journal Entry History Inquiry will see enhancements too. In today's world, the existing window only looks at the open tables. The plan for GP "12" is to have it look at both open and/or history.

In the reporting area, you will be delighted to know that you will now be able to choose a printer at print time. This feature was only 20 years in the making, but it's finally here! Hey, I remember like if it was yesterday, when Windows True Type fonts became a standard part of Report Writer reports. Before that, we only had 4 fonts to play with. Challenge: name the 4 fonts available prior to the introduction of True Type fonts.

SSRS Simplicity

In addition to the printer at print time, one of the most awaited features is the ability to print SSRS reports from right within Microsoft Dynamics GP, this is, you will no longer need to wait for the Internet Explorer browser to load Report Server to display the report and will rather see the report from within GP as if you were looking at a Report Writer report in the report layout window... ah, and before I forget, Report Writer will eventually be phased out as the predominant options to render reports.

I don't know how this plays with all that Word Template functionality released fairly recently, but I am sure a lot of you will jump on one feet in happiness knowing that you no longer will need to suffer through the tortuous process of customizing a report. My instinct tells me, that Report Writer will mainly subsists as a data delivery mechanism for XML files needed for your beloved Word Templates. If history and memory serve me well, Microsoft rarely gets rid of a working function within its products, except it becomes as annoying as the Office Paperclip Assistant. Now that I come to think, Report Writer is got to be up there for a lot of you.

I will continue tomorrow with the Productivity pillar.
Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Business Analyzer, Dynamics GP 12, Report Writer, Reporting, Roadmap, SQL Reporting Services, Word Templates | No comments

Thursday, 7 July 2011

More Microsoft Dynamics GP Word Templates Articles

Posted on 07:48 by Unknown
If you have been keeping up with this blog, you will remember that sometimes around October of 2010 I posted a series of articles related to Microsoft Dynamics GP Word Templates - see Microsoft Dynamics GP 2010 Word Templates summary for more information. These articles focused on "how to's" and troubleshooting aspects of Word Templates.

Now the Dynamics Support and Services Team Blog has decided to launch a new set of video-articles detailing more common aspects of working with Word Templates. You can now visit the Community Team blog for the release article and the schedule of when these videos will be out. The good news is the first two are out!

Take a look at:

Adding the Developer tab in Microsoft Word after installing the Microsoft Dynamics GP Add-in for Microsoft Word - Video



Helpful tips when modifying Word Templates in Microsoft Dynamics GP 2010 - Video


Please visit the Dynamics GP Support and Services Blog for these videos and to find a collection of very new and interesting articles.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/
Read More
Posted in Community, Training, Troubleshooting, Word Templates | No comments

Monday, 7 February 2011

Why my template changes don't save when I close Microsoft Word?

Posted on 15:33 by Unknown
If you are now a user of Microsoft Dynamics GP 2010, you will concur that the new Word Templates feature is probably one of the most visible improvements over version 10.0 as it has made the delivery of 'facing' documents a pleasant one.

However, the new feature has not come without misunderstandings on how it works. One such misunderstandings has to do with the way template documents are opened, changed, and saved. Many users have found out the hard way that there's a bit more to just hitting the save button in Microsoft Word. So, let's review the few critical steps of opening a Word Template and ensuring that all changes are properly saved in Microsoft Dynamics GP, in the process, I will explain what happens "under the hood".

1. In the following example, I have taken a new template created for Aaron Fitz Electrical (AARONFIT0001) based on the original SOP Blank Invoice Form and have opened it and added a logo to it.


SOP Blank Invoice Form Template - AARONFIT0001

Upon opening the template (by clicking the Modify button), Microsoft Word automatically creates an image of the template in the user's local temp folder.


Template image in %temp% folder

In this scenario, and to simulate the subject of this post, we will proceed and save the template -- assuming the logo is all we wanted to add to the template. Microsoft Word will save the document as it would normally do with any other document. We then proceed to close Microsoft Word.

Upon revisiting the %temp% folder. The modified template is no longer available.

Template is no longer available after closing Microsoft Word

Hence, if you were to print the SOP Blank Invoice Form -- assigned to customer Aaron Fitz Electrical -- from within Microsoft Dynamics GP using the Template report, chances are the system would revert to the standard template as the changes would not be found.

In order to overcome this issue, here are the correct steps to have your templates available all the time:

1. Upon completing the modifications of the template in Microsoft Word, save your templates under your My Documents folder. If your templates are going to be used by all users in your environment, save the template to a network shared folder.  In any case, use the Save As option in Microsoft Word to save your document.

Save As to save template document

NOTE: if you are also going to use logo images with your templates, be sure to save these also on a shared folder.

2. Upon saving the template, you will now use the Add button to re-add the template you have just previously saved. This will now ensure that all your changes are imported and stored in Microsoft SQL Server.

Add template

That's it for avoiding a major headache with the loss of a very customized Microsoft Word template.
Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.intellpartners.com/
Read More
Posted in Word Templates | No comments

Monday, 6 December 2010

Enabling a Report Writer document as a Word Template

Posted on 18:16 by Unknown
Ok, this is directly or indirectly a Report Writer subject, but nonetheless a topic related to Report Writer. In this example, I take the General Posting Journal transaction document and enable it under Word Templates. However, this example will not develop the Word Template itself, but rather show how easy it is to make the journal document template enabled.

The steps are very simple and in fact, with a little bit of creativity, a developer could potentially write code that quickly enables critical reports.

To enable an existing Microsoft Dynamics GP report:

1. Register a trigger against the IsTemplateEnabledReport() function of the syReportLookup form. Template enabled reports can be selected in the Reports lookup window.

Startup
{ Created by Mariano Gomez, MVP
This code is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 2.5 Generic license.
}
local integer l_result;

pragma (disable warning LiteralStringUsed);

l_result = Trigger_RegisterFunction(function IsTemplateEnabledReport of form syReportLookup, TRIGGER_AFTER_ORIGINAL, function glPostingJournalReport);
if l_result <> SY_NOERR then
warning "Trigger registration for General Posting Journal report failed.";
end if;

pragma (enable warning LiteralStringUsed);

Note: You will need to save the Startup script first (CTRL+S), and compile the dictionary when the trigger processing function is implemented.

2. Now that we have our Startup script and the trigger registered, we can implement the trigger processing function. In this case, I have labeled this function glPostingJournalReport().

glPostingJournalReport()
{ Created by Mariano Gomez, MVP
This code is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 2.5 Generic license.
}
function returns boolean result;

in 'Product ID' nProdID;
in Resid nResID;

if nProdID = DYNAMICS then

{It's our report. Indicate that it is template enabled.}
case nResID
in [resourceid(report 'General Posting Journal')]
result = true;
end case;
end if;

Note: In the above code I am using the dictionary constant DYNAMICS for the product ID as our report belongs to the core dictionary. Also, rather than hardcoding the resource Id for the report, I am using SanScript's resourceid() function to obtain the resource Id for the report.

3. Open Dexterity Utilities to extract and autochunk your dictionary into a final product. The following are the settings I used for this particular project:


Auto-Chunk and Product Information windows
4. Drop your chunk file in the Dynamics GP folder and make sure that you can see your trigger in action in the Reports lookup window under Report Template Maintenance.


Reports Lookup window

Now that we have won half the battle, I will show in my follow up post, how to actually implement the template and make it all work together.

Downloads:

Extracted dictionary - Click here
Chunk file - Click here

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Read More
Posted in Dexterity, Dynamics GP 2010, Report Writer, Word Templates | No comments

Friday, 1 October 2010

Microsoft Dynamics GP 2010 Word Templates summary

Posted on 12:00 by Unknown
Microsoft Dynamics GP 2010 Word Templates offer new presentation capabilities to the traditional customer/vendor facing Report Writer reports. This week was just a superficial scratch of the myriads of things that are possible to achieve. Like with everything else, I am sure there are limitations, but it will take some time to discover what those are. Nonetheless, I will continue exploring this topic and bring to you my findings

Articles Covered

How to add a "Terms and Conditions" page to a Microsoft Dynamics GP Word Template document
Debugging Microsoft Dynamics GP 2010 Word Templates
How to resize logo in Microsoft Dynamics GP Word Templates
The Open XML SDK 2.0 for Microsoft Office

Acknowledgements

I have to thank Microsoft's Rob Wagner for his invaluable support and guidance throughout the week. Rob also provided the cool code and pointed to the online resources available on the Open XML subject.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Read More
Posted in Dynamics GP 2010, Microsoft Office, Word Templates | No comments

The Open XML SDK 2.0 for Microsoft Office

Posted on 04:00 by Unknown
Along with the introduction of Microsoft Dynamics GP 2010 Word Templates came a little known software development kit: Open XML SDK 2.0.

Open XML is an open ECMA 376 standard and is also approved as the ISO/IEC 29500 standard that defines a set of XML schemas for representing spreadsheets, charts, presentations, and word processing documents. Microsoft Office 2007 and Microsoft Office 2010 all use Open XML as the default file format for rendering spreadsheets, documents, and presentations.

The Open XML file formats are useful for developers because they use an open standard and are based on well-known technologies: ZIP and XML.

The Open XML SDK 2.0 for Microsoft Office is built on top of the System.IO.Packaging API and provides strongly typed part classes to manipulate Open XML documents. The SDK also uses the .NET Framework Language-Integrated Query (LINQ) technology to provide strongly typed object access to the XML content inside the parts of Open XML documents.

In the case of Microsoft Dynamics GP 2010, the assembly enables developers to easily read-from and write-to Microsoft Word documents using their favorite language in Microsoft Visual Studio. The following image depicts the assembly in the Global Assembly Cache (GAC).


You can find more examples and a cool tool available at the Open XML SDK 2.0 download site. Using this tool, Rob Wagner was able to compare the original template shipped with GP and the modified version I created, when troubleshooting some issues I was having when adding a new section to the original template – see Debugging Microsoft Dynamics GP 2010 Word Templates.

Using the Open XML to work with Word documents

The following C# console application demonstrates how to use OpenXML to add a new table to the end of a document (similar to the text added in the “terms and conditions” article).

//---------------------------------------------------------------------
// This file is a Microsoft Dynamics GP Business Intelligence Code Sample.
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//This source code is intended only as a supplement to Microsoft
//Development Tools and/or on-line documentation. See these other
//materials for detailed information regarding Microsoft code samples.
//
//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using wp = DocumentFormat.OpenXml.Wordprocessing;

namespace NewTableAdHocText
{
class Program
{
public bool AddTableAdHocText(string WordDocPath, string TextPath)
{
try
{
//read the ad-hoc text and store it for later
StreamReader srStreamReader = new StreamReader(TextPath);
String sString = srStreamReader.ReadToEnd();

//open the word document and it's main document part
using (WordprocessingDocument wdWordDoc = WordprocessingDocument.Open(WordDocPath, true))
{
MainDocumentPart mdpWordDocMainPart = wdWordDoc.MainDocumentPart;
//create then add a new paragraph
wp.Paragraph wppParagraph = new wp.Paragraph(new wp.ParagraphProperties(new wp.ParagraphStyleId() { Val = "NoSpacing" }));
mdpWordDocMainPart.Document.Body.Append(wppParagraph);
//create new markup for the table
Table wppTable = new Table(
new TableProperties(
new TableStyle() { Val = "TableGrid" },
new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto },
new wp.TableBorders(
new TopBorder() { Val = BorderValues.None },
new LeftBorder() { Val = BorderValues.None },
new BottomBorder() { Val = BorderValues.None },
new RightBorder() { Val = BorderValues.None, },
new InsideHorizontalBorder() { Val = wp.BorderValues.None },
new InsideVerticalBorder() { Val = wp.BorderValues.None }),
new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }),
new TableGrid(
new GridColumn() { Width = "11016" }),
new TableRow(
new TableCell(
new TableCellProperties(
new TableCellWidth() { Width = "11016", Type = wp.TableWidthUnitValues.Dxa }),
new Paragraph(
new ParagraphProperties(
new ParagraphStyleId() { Val = "NoSpacing" },
new KeepLines(),
new PageBreakBefore(),
new ParagraphMarkRunProperties(
new RunFonts() { Ascii = "Trebuchet MS", HighAnsi = "Trebuchet MS" },
new FontSize() { Val = "17" },
new FontSizeComplexScript() { Val = "17" }),
new LastRenderedPageBreak(),
new Run(
new RunProperties(
new RunFonts() { Ascii = "Trebuchet MS", HighAnsi = "Trebuchet MS" },
new FontSize() { Val = "17" },
new FontSizeComplexScript() { Val = "17" },
new Text(sString)))))))); //text for the run comes from the adhoc text document
//add then save the table to the document
mdpWordDocMainPart.Document.Body.Append(wppTable);
mdpWordDocMainPart.Document.Save();
}
}
catch (Exception e)
{
Console.WriteLine(e.InnerException);
return false; //failure
}
return true;
}

static void Main(string[] args)
{
new Program().AddTableAdHocText(args[0], args[1]);
}
}
}

The above example shows how simple it is to:

1) Crack open a word document.
2) Append a table to the end with specific properties.
3) Insert some ad-hoc text into the table.

The major advantage is the strongly typed interface to office document. You don’t need COM interoperability to manipulate any document.

You can download the sample project at the bottom of this article.

Downloads

NewTableAdhocText.zip - C# command line application to demonstrate adding a table at the end of a Word Document.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Read More
Posted in C#, Code, Microsoft Office, OpenXML, Visual Studio 2008, Word Templates | No comments

Thursday, 30 September 2010

How to resize logo in Microsoft Dynamics GP Word Templates

Posted on 14:32 by Unknown
Getting used to the new Word Templates functionality can be a bit challenging at times. One of those challenges came in the form or a simple question: "How to resize the logo on the template?". One thing to keep in mind is that most objects on a Microsoft Dynamics GP Word Template document live inside of content controls. With that said, here are the steps to achieve this, taking the SOP Blank Invoice Form Template* as an example:

1. Under Report Template Maintenance, select the SOP Blank Invoice Form template from the More Reports list.

2. Click the New button to create a new template. For this example, we will create the template based on the existing template and we will call it SOP Blank Invoice Form Icon. Click Ok to continue.



3. Highlight the newly created template, then click the Modify button to open Microsoft Word.



4. Click on the Picture content control to add a logo image.



Note: This image must also exist in the Image library under Template Configuration.

5. Select the logo, right-click, and chose Remove Content Control.



6. Highlight the image and resize accordingly. The following is a sample of the resized image with some extra text to go along:



NOTE: The logo is part of the Header section of the document.

7. Save the modified template to a different directory where it can be imported from later on, for example, My Documents. Close Microsoft Word.


8. Back to Report Template Maintenance, click the Add Template button and select the newly modified template from the My Documents folder. Replace the existing one when prompted.

9. Click the Assign button, then mark the company you want to assign the template to. Then, click on Set as Default to make the new template the default template for the company. Click Save to continue. Click Save to continue.


10. Back to the Report Template Maintenance window, highlight the original template and click the Assign button and choose Company. Unmark the company and choose Save.


NOTE: This will ensure that the copied version of the original template prints always.

11. To test, select a SOP invoice and print.


Hope you found these steps simple to follow and that you are enjoying the new Word Templates feature in Microsoft Dynamics GP 2010.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Read More
Posted in Dynamics GP 2010, Microsoft Office, Reporting, Sales Order Processing, Word Templates | No comments
Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • The Dynamics GP Blogster's best articles of 2012
    It's that time of the year again! Time to say goodbye to the outgoing year, 2012, and receive the new one, 2013, making all sort of reso...
  • What's new in Microsoft Dexterity 11.0
    The excitement around Microsoft Dynamics GP 2010 could not be any higher. Traffic on my site has doubled since I began releasing informatio...
  • Vote for your 2012 GPUG All Star
    The time has come again to vote for the next year's GPUG All Star awards. Surprisingly, I have been nominated to this award along with f...
  • How to add a "Cover Letter" page to a Microsoft Dynamics GP Word Template document
    I wrote an article almost a year ago showing a simple technique to add a  Terms and Conditions page to a Microsoft Dynamics GP Word Templat...
  • "Unable to access SnapIn config data Store" accessing Web Management Console
    For quite some time I had been running into this error when attempting to access the Microsoft Dynamics GP 2013 Web Management Console appl...
  • Running Windows 8.x Business Analyzer app on a laptop with SQL Reporting Services
    If you are a consultant, chances are you run your Microsoft Dynamics GP application demo environment on a laptop along with Microsoft SQL Se...
  • Adding more comment lines to POP Purchase Orders
    Just recently, I was asked by a customer to address an issue with their line item comments truncating at 4 lines. In essence, the customer w...
  • Extender Auto Open and Auto Close options not working in GP 2010
    Just recently, I came across an issue reported by a partner on Extender Auto Open and Auto Close options not working. Extender Auto Open a...
  • New Article on MSDynamicsWorld: Do's and Don'ts of Microsoft Dynamics GP Forums
    Many of you know me as an avid forum contributor - I can usually be found on the Microsoft Dynamics GP Partner Online Technical Community ...
  • Adding Customer Item User Defined fields to SOP Invoice
    Just recently I ran across a request to add the Customer Item user defined fields to the Sales Blank Invoice Form report in Report Writer. A...

Categories

  • Ad Campaigns
  • ADO
  • Adobe Acrobat
  • Analytical Accounting
  • Architecture
  • Around the Blogosphere
  • Article
  • Azure
  • Bank Reconciliation
  • Best of 2009
  • Best of Series
  • Best Practices
  • Bing Maps Enterprise
  • Books
  • Business Alerts
  • Business Analyzer
  • C#
  • Code
  • COM
  • Community
  • Compliance
  • Connect
  • Continuum
  • Convergence
  • Corporate Performance Management
  • CRM
  • Database Maintenance Utility
  • Decisions Conference
  • DEX.INI
  • DEXSQL
  • Dexterity
  • Discussions
  • Drill-Down Builder
  • Dynamics GP 10
  • Dynamics GP 11
  • Dynamics GP 12
  • Dynamics GP 2010
  • Dynamics GP 2010 R2
  • Dynamics GP 2013
  • eConnect
  • EFT
  • Electronic Banking
  • Encumbrance
  • Events
  • Extender
  • Field Services
  • Fixed Assets
  • Forecaster
  • From the Newsgroups
  • FRx
  • Functionality
  • General Ledger
  • GPUG
  • Home Page
  • Human Resources
  • Humor
  • IMHO
  • Installation
  • Integration
  • Integration Manager
  • Internet Explorer
  • Inventory
  • Kinnect
  • Maintenance
  • Management Reporter
  • Manufacturing
  • Menus for Visual Studio Tools
  • Microsoft Office
  • Modifier
  • Multicurrency Management
  • Multitenancy
  • MVP Summit
  • MVPs
  • Named Printers
  • Navigation Pane
  • Notes
  • ODBC
  • Office Web Components
  • OLE Container
  • Online Services
  • OpenXML
  • Partner Connections
  • Payables Management
  • Payroll
  • Performance
  • PO Commitments
  • Printer Compatibility
  • Product Feedback
  • Project Accounting
  • Purchasing
  • Receivables Management
  • RemoteApp
  • Report Writer
  • Reporting
  • Roadmap
  • SafePay
  • Sales Order Processing
  • Season Greetings
  • Security
  • Service Call Management
  • SharePoint
  • SmartList and SmartList Builder
  • SQL Reporting Services
  • SQL Scripting
  • SQL Server
  • Support Debugging Tool
  • Tax Updates
  • Technical Conference
  • The Partner Event
  • The Technology Corner
  • Training
  • Translation
  • Troubleshooting
  • Upgrades
  • VAT
  • VB.NET
  • VBA
  • VBScript
  • Visual Studio 2008
  • Visual Studio Tools
  • Web Client
  • Web Services
  • Windows 7
  • Windows 8
  • Word Templates
  • XBox
  • XBRL

Blog Archive

  • ▼  2013 (68)
    • ▼  December (2)
      • Visual Studio Tools for Microsoft Dynamics GP 2013...
      • Web Client Wednesday: Microsoft Dynamics GP on Azure
    • ►  November (8)
    • ►  October (5)
    • ►  September (5)
    • ►  August (3)
    • ►  July (8)
    • ►  June (5)
    • ►  May (5)
    • ►  April (2)
    • ►  March (11)
    • ►  February (6)
    • ►  January (8)
  • ►  2012 (101)
    • ►  December (8)
    • ►  November (6)
    • ►  October (15)
    • ►  September (16)
    • ►  August (9)
    • ►  July (4)
    • ►  June (4)
    • ►  May (6)
    • ►  April (4)
    • ►  March (11)
    • ►  February (4)
    • ►  January (14)
  • ►  2011 (158)
    • ►  December (7)
    • ►  November (17)
    • ►  October (7)
    • ►  September (8)
    • ►  August (8)
    • ►  July (12)
    • ►  June (12)
    • ►  May (13)
    • ►  April (23)
    • ►  March (21)
    • ►  February (10)
    • ►  January (20)
  • ►  2010 (168)
    • ►  December (15)
    • ►  November (11)
    • ►  October (12)
    • ►  September (24)
    • ►  August (13)
    • ►  July (12)
    • ►  June (8)
    • ►  May (17)
    • ►  April (14)
    • ►  March (9)
    • ►  February (16)
    • ►  January (17)
  • ►  2009 (5)
    • ►  December (5)
Powered by Blogger.

About Me

Unknown
View my complete profile