You probably have already used the Dynamics AX add-in within Excel to access data, but don’t forget that you can also do something similar within Word as well in order to create templates that will merge in data directly from Dynamics AX with the push of a button. But it doesn’t stop there, you can then save the Word templates back to a template library and Dynamics AX will make it available to everyone through the client itself.
This is a great way to create lightweight reports or commonly used templates for correspondence that you have instant access to.
Before you start, you need to make sure that you have a query that Word is able to use as a data source. Also, this query needs to be linked in some way to the master tables that are used in the main data forms, i.e. the CustTable.
If you have not already got queries defined, then you can do this by clicking on the Document Data Sources in the Document Management folder of the Setup group of the Organization Administration area page.
When the Document Data Sources maintenance form is displayed, click on the New button in the menu bar, and add a new record that has a Document Source Type of Query Reference and a Data Source Name of CustTable
When you have done this, just click on the Close button to exit the form.
How To Do It…
To create a template in Word, all you need to do is select the Dynamics AX ribbon bar and click on the Add Data button within the Design group.
When the Add Data dialog box is displayed, you can select the CustTable data source and then click the OK button.
This will open up a field explorer on the left which you can then just drag and drop any field from into the Word document in order to create field placeholders.
Additionally, if you create a table within the word document then you can create a repeating element.
Once you have created the template you can save it and then click on the Merge button within the Data group of the Dynamics AX ribbon bar.
This will create a new document that is populated with the data from Dynamics AX.
The next step is to make this template available to the users within Dynamics AX itself. To do this, create a Document Library within SharePoint and save your new template there.
Once we have the document library, we just need to synchronize it with Dynamics AX by opening up the Document Types menu item within the Document Management folder of the Setup group of the Organization Administration area page.
If you don’t already have one, create a new Document Type with a Class of Template Library. This will allow you to point to the SharePoint Site where you put your Word document, and then click the Synchronize button within the Document Templates tab.
This process should discover your document and then you can make it available by clicking on the If you don’t already have one, create a new Document Type with a Class of Template Library. This will allow you to point to the SharePoint Site where you put your Word document, and then click the Active checkbox.
How It Works…
This will allow you to open up the master data form that is connected to your Word template (in this case the Customer maintenance form) and if you click on the Generate From Template button within the Attachments group of the Customer ribbon bar, you will see your document template is available to be selected.
Clicking on it will create a new Word document for you using the merge template that you created.
Also, it saves the document away as an attachment so that you can always reference back to it.
How cool is that.
Share this post