Demonstration how to add a new field (due date) to Free text invoice report (Dynamics 365)
In this example is demonstrated how to add a new field to a Dynamics 365 standard form “Free text invoice” (path: Accounts receivable | Invoice |All Free text invoices)
In this example we going to add field ‘Due date’ in the header section of the Free text invoice Report report.
First step is creating an extension for the table ‘FreeTextInvoiceHeaderFooterTmp’. This table contains the information used in the header section of the report. Here we add the new header field.
Then we extend the standard FreeTextInvoice report.
When we restore the “FreeTextInvoiceHeaderFooterDS” datasource, the newly created field is available in the form datasource.
Set the ‘expression’ of the data source field as follows:
We can find the due date in the CustinvoiceJour table, field ‘DueDate’.
The recId of the custInvoiceJour is available in the FreeTextInvoiceContract class, method ‘parmCustInvoiceDuplicateRecId’.
Logic to get custInvoiceJour buffer:
We also need update the ‘DueDate’ field in the FreeTextInvoiceHeaderFooterTmp. We need an instance of the table, and then update our newly created field ‘DueDate’ of the table by looping all it’s records. We update this field, with the CustInvoiceJour.DueDate.
An instance of the the FreeTextInvoiceHeaderFooterTmp is available in the dataprovider class (FreeTextInvoiceDP), method “getFreeTextInvoiceHeaderFooterTmp().
The logic for the class:
Now we have to do a Rebuild.
And deploy the report.
After restarting the Free text report, we see that the field is added.