7 April 2014

4 Easy Steps to Creating Word Documents that Include ERP Data

4 Easy Steps to Creating Word Documents that Include ERP Data

By using To-Increase Connectivity Studio to connect Microsoft Dynamics AX and Microsoft Word, you can easily create Word documents that include information from the ERP system. Today, I’ll show you how this works. The solution takes advantage of the rich Word capabilities, including layout options and styles, together with the efficient setup and power of Connectivity Studio to map your data model. You can define the integration with Microsoft Word in the same was as you define integrations for XML, EDI, Microsoft Excel, or text. You also have the option to generate documents based on conditions such as language, project phase, or project type.

Today’s usage scenario is especially common in architectural, engineering, construction, and professional services companies, where it is often necessary to generate contract documents that need to include data from Microsoft Dynamics AX as well as logos and pre-set text content. They usually involve standardized text fields, tables with lists of values, or header paragraphs. Usually, companies also want to personalize the documents, so they address a customer by name instead of “dear customer.”

The Basic Process

You can use Connectivity Studio to define how you want to publish Microsoft Word documents. To do this, you set up the source from Microsoft Dynamics AX and export it to Microsoft Word. One large advantage in this process is that you don’t need to have Microsoft Office installed on your server, because the documents are generated with Microsoft Office Open XML, an XML-based file format for documents, spreadsheets, and other files. You can potentially save substantial license fees as a result.

In Connectivity Studio, you combine the setup and template capabilities to control the layout of a Word document. In the following exercise, I take you through the sequence of exporting a sales order and generating a nice-looking Word document based on an existing template. In this template, you can add references, predefined texts, and logos. The process involves four simple steps:

1 - Create your template.
2 - Define which Microsoft Dynamics AX data you want to use.
3 - Define how you want to map the ERP data to Microsoft Word.
4 - Watch the result!

 

Create Your Template

In the template, we use sales order data. We create a header, a table for the sales lines, and some fixed text within that template. To begin with, you create a new document in Microsoft Word and save it as a template.

How to create Word document template in Connectivity Studio

In Connectivity Studio you then create a document to describe how the data should be mapped.

How to create a document to describe data mapping in Connectivity Studio

For each record, you can define specific settings. You can show a record and use it to:

- Replace fields
- Show it as a paragraph
- Show it in a table

Again for each record, you can also specify the options. In the sample below you see that we show the sales order as a paragraph. The marker is [SalesOrder], and you can add it to the template.

How to show sales order as a paragraph using Connectivity Studio

For the fields, you can also specify how they will appear in Microsoft Word. For example, you can define the location of the label, if it is a fixed or a language-specific label, or if you need a line break after each field in the paragraph.

Word AX 4

The sales line appears in a table. The table style can be selected from the template. This integration makes it very easy to set up and control the layout.

Word AX 5

Define Which Microsoft Dynamics AX Data You Want to Use

Your setup is now ready for Connectivity Studio. You still need to specify which data should be used for the sales order. In this sample, we only use data from the sales table and header. You only need to select the fields which are required for the Word document.

How to define which Dynamics AX data you need for Word

Define How You Want to Map the ERP Data to Word

You have now defined the source and target. Next, you to define the mapping between the two data models. A message in Connectivity Studio links source and target.

How to map ERP data to Word with Connectivity Studio

You can now map the data. In the mapping, you can also use advanced options such as constant values, lookup values from other tables, and available display methods. In this sample, we map the sales table once for the paragraph and once for the specific fields.

Mapping the sales table with Connectivity Studio

Watch the Result

Run the message for a sales order and check out the result:

How to check result when message is run for a sales order

As you see in the screen shot, you can also run this task in a batch. Word documents can then be generated on a batch server, with very fast parallel processing.

Below, you see the fine result with data from Microsoft Dynamics AX.

How to generate Word documents on a batch server with data from Dynamics AX

But there’s more! In addition to what you just saw, we support multiple languages. You can use the label IDs in the Word document and generate the template using the order language.

How to generate a template using order language in Connectivity Studio

You can also set up templates per language, which is the most commonly used condition. This capability is very useful when you use fixed texts in your document.

How to set up templates per language in Connectivity Studio

As you see, this is a very efficient way to create high-quality Word documents that include ERP data. If you have questions or would like to know more about the process, please contact us .

Download the factsheet to know more about Connectivity Studio

To-Increase-Connectivity-Studio-for-Microsoft-Dynamics-365-Factsheet
Pieter de Jong
Pieter de Jong,
Pieter de Jong,
Technical Solution Architect

Also interesting