Skip to main content

Document Handling In Axapta

Document Handling In Axapta


When we create a new word document through document handling , we can transfer data from tables in Microsoft Dynamics AX to bookmarks in the new document. This is done by creating a template with some standard text and some bookmarks where the data from tables are to be inserted. For example we can transfer the address and contact information for a customer to the letter head in a Microsoft Word document when creating a new letter for that customer.
Prepare a Word template :We need to create a Word template with bookmarks where the data should be inserted. Then we set up the document type by linking the document type to the template and by adding the data fields to be transferred to the individual bookmarks.
Step I : Create a Word template
1.            Open Microsoft Office Word.
2.            In the new template, add the text and graphics we want to appear in all new documents that we base on the template.
3.            Place the cursor where we want to insert data from Microsoft Dynamics AX and then click Insert > Bookmark.
4.            Type a meaningful name for the bookmark and click Add.
5.            By Repeating step 3 & 4 you can add more bookmarks as much as you require
6.            Save this template by extension .dotx







Note : It is important to use a table where more than one row of data is needed. e.g. if we are expecting to insert more than one invoices for a vendor as shown in the above screen shot. This will help maintain the format when the data is populated by the system. Otherwise the data will be distorted.
Step B : Link the template to a document type
1.            Click Basic > Setup > Document management > Document types.
2.            Select the document type that we want to link to a template.
3.            Click Options.
4.            In the Table list, select the table to associate with the template.
5.            In the Template file list, type the path to the template file or use the browse button to locate the file on the computer or network.
Class description:             Create Word document via COM
Group:                                  Document          


Step C : Add bookmark information to table fields
1.            Click the button “Option”.. In the Options form, On overview tab give the name of the table and path of the template file
    select the table that is linked to the template that we want to use.
2.            Select the Fields tab.
3.            Press CTRL+N to add a field to be transferred.
4.            In the Data table list, select a table to get data from.
5.            In the Data field list, select the data field to get data from.
6.            In Bookmark, type the name of the bookmark we have inserted in the document where the data will be inserted.
7.            Select Hard return to insert a line break after the data inserted (optional).
8.            Repeat step 3 through 7 to add more data fields to the list.
Note : The table we get the data from does not have to match the table selected on the Overview tab, but the two tables have to be related.
                The Document handling feature can only create one letter per invoice.
On Field tab select the AX table and fields as shown below in the screen shot . For each field give the Bookmark from the template.




Step D : Test the report
Go to vendor master and select a vendor whose invoices have been  pending / on hold.
Click document handling button. Indocument handling click the Button New and select the document type created in previous Step B.

A word document will be created with data for the vendor




Verify the data on the document. Pls note that the invoice number date and amount fields are nicely aligned . If the bookmarks had not been in a table in the template then the invoice details would have been distorted. ( try using  a template with bookmarks without table and see yourself )



These small steps can reduce your new report requirement.

Comments

Popular posts from this blog

Customization Tips for D365 for Finance and Operations How to configure Excel Add in D365 Finance and Operations August 1, 2021 by alirazazaidi I recorded how to configure Excel Addin for D365 finance and operations. How to configure Power BI out of the box dashboard on local VM Dynamics 365 for Finance and Operations July 17, 2021 by alirazazaidi Hi friends, here is video, which I recording during configuring Dynamics 365 Finance and operations out of the box dashboard on local VM. My session is held on Urdu Hindi User group on 1 August. For this I need to configure it. During development we need to configure these dashboards and some times we need to extend these dashboard. Hope this video will helpful to you. How hide SSRS Parameter RDP Menu Name Dynamics 365 Finance and Operations

  Again documentation class XYZUIBuilder extends SrsReportDataContractUIBuilder { public void build() { RecId hcmWorkerRecId; str name, menuItemName; FormBuildGroupControl grp; //Dialog dialogLocal = this.dialog(); XYZDC rdpContract = this.dataContractObject(); DialogField workerfieldDiff; DialogField _FromDate,_Todate; // Add the pay cycle field. menuItemName = this.controller().parmArgs().menuItemName(); workerfieldDiff = this.addDialogField(methodStr(XYZDC ,parmworkerrecid),rdpContract); // hcmWorkerRecId = HcmWorker::userId2Worker(curUserId()); if (menuItemName =="ESSReport") { workerfieldDiff.visible(false); workerfieldDiff.value(0); } _FromDate= this.addDialogField(methodStr(BEKenyaP9DC,parmFromDate),rdpContract); _Todate = this.addDialogField(methodStr(BEKenyaP9DC,parmToDate),rdpContract); } }

D365 : SEND EMAIL

 class SRSendEmail_D365 {            public static void main(Args _args)     {           SysMailerMessageBuilder messageBuilder = new SysMailerMessageBuilder();         Email   toEmail;         Email   fromEmail;                   try         {             FromEmail = "fromemail@xyzcompany.com";             toEmail   = "oemail@xyzcompany.com";             messageBuilder.setBody("Hello from D365", false);             messageBuilder.setSubject("Email Test from D365");             messageBuilder.addTo(toEmail);             // Note: not calling setFrom() defaults to the current user for SMTP client, whereas ...

CODE TO PDF IN AX 2012

static void Job1(Args _args) {         PurchPackingSlipController      ssrsController = new SrsReportRunController();         TradeDocumentReportContract     purchPackingSlipContract = new TradeDocumentReportContract();         SRSPrintDestinationSettings     printerSettings;         VendPackingSlipJour             VendPackingSlipJour;         Args                            args;         //select the latest record based on create date         while select VendPackingSlipJour             order by VendPackingSlipJour.createdDateTime DESC             where VendPackingSlipJour.PackingSlipId == 'LJ-01'         ...