I just got a chance to work on creating document using word or excel template. in Dynamics AX we have a very good feature in document handling Create Word document via COM or Create Microsoft Office Excel worksheet via COM. Using these features we can create word or excel template, and create and attached the document to the record filling the template fields from the table record.
I don’t want to explain how to setup this type of document, you can read the blow link for that,
The problem arises when i try to use the the field which is not on the table or don’t have a direct relation with the table i have setup. For example, i have used the SMAServiceOrderTable and i have requirement to fill the “Payment term” on the template, which is on the ProjInvoiceTable. Which has a relation with SMAServiceOrderTable through ProjTable (SMAServiceOrderTable->ProjTabe->ProjInvoiceTable).
The solution i think for this problem is to customize Document handling feature to have the provision of using the method of the table instead of just the fields.
So the problem solved, I added a field on the “DocuField” table for methodName modify some classes. I have provided the link for the XPO for that.
I have modified the DocuField table so that method name of the table can be specified.
Then i make changes on the \Classes\DocuActionTrans\insertField method, to get the value from method using DictTable class.
Thanks for Reading.