The Dynamics AX document handler has always been able to generate Word (or Excel) documents using Dynamics AX data (and that functionality still exists) but this functionality was extended and made easier to use in Dynamics AX 2012.
‘Template libraries’ are a new document type introduced in Dynamics AX 2012.
Go to Organisation administration > Setup > Document management > Document types and define a new document type (if required):
A Template library is a shared folder on a SharePoint site. You define the folder to be used in the Document templates fast tab which becomes visible when you select the Class ‘Template library’.
The standard demo Hyper-V Enterprise portal site includes a Shared directory. I created a new Shared folder and set the SharePoint site address and selected my folder:
Create a template
Open Word, and log into Dynamics AX using the office add-in:
Use the Add data button to add a document source:
The Fields action pane will show you all of the fields (and linked tables) from your data source.
Create your document template and add fields by dragging them into the template:
When you’re done, save the template as a normal word document (not a template) in your Template library folder:
Back in Dynamics AX, on the Document types form click ‘Synchronise’:
You can see that the system’s recognised the Primary table from the data source.
Now Activate the template:
Use the template
You’ll need to be on a form related to your ‘Primary table’ (Quotations in my case). This form has got a ‘Generate from template’ button and that shows the active templates linked to the form/table:
Click that option and the system opens word, creates a word document attachment linked to the selected record, and populates the fields on the template:
The document’s added as a Document handler attached document:
On the Document Handler, notice that the New button includes the template as an option (and this is how you add template documents when there’s no ‘Generate from temple’ option available on the main form):