Filling PDF Forms with Electronic Reporting in Dynamics 365 for Finance

Filling PDF Forms with Electronic Reporting in Dynamics 365 for Finance

Dynamics 365 Electronic Reporting (ER) supports output into Excel, Word, and PDF formats. Excel and Word templates are well-covered in documentation and practice, but PDFs remain obscure – there’s only a short article Design ER configurations to fill in PDF templates – Finance & Operations | Dynamics 365 | Microsoft Learn from Microsoft.

The PDF/File component in ER is usable, it fills out static PDF forms. For example, one may take the VAT return or another tax declaration form, import into the ER configuration designer and get it filled out.

Technically, this resembles the old Dynamics Axapta approach using XFDF to inject data into form fields. That still seems to happen under the hood: you map values to fields, and the form gets filled in and flattened into a non-editable PDF. However, PDFs don’t support repeatable ranges like Excel – everything is fixed on the page. If there are – let’s say – several lines, then the subtotals below won’t slide on the PDF page. They’ll remain on the same page as placed on the PDF form, and remain on the exact place on the form.

To simulate Excel-like ranges, Microsoft introduced a naming trick. You create form fields named, e.g., LineNo1, LineNo2, …, LineNo10. In ER, you create a Field group containing a single LineNo field. ER fills LineNo1 with the first record, LineNo2 with the second, and so on. If only two records are present, only LineNo1 and LineNo2 get filled—the rest stay blank. You must not exceed the number of fields available in the form: 11 records will crash the report.

  1. To prepare such a form, you need Adobe Acrobat (not the free Reader). Create a fillable form and assign field names. For repeated fields like headers or footers (e.g. Total_pages), it’s okay to copy-paste – Acrobat auto-numbers them visually (Total_pages#1, #2) but they’re still internally just one field, and ER will fill all copies identically. That is ideal for values repeated on every page.
  2. For tables where every row must be unique, the fields must have unique names (LineNo1, LineNo2, etc.). Renaming manually gets tedious fast. A handy script Acrobat — Rename Duplicate Fields to Unique Fields | Try67 | Custom PDF tools (the script is commercial + Adobe Acrobat Pro is required) automates this: draw a rectangle over the fields, and it appends unique suffixes to overlapping fields across pages. You can prepare a single line of fields, copy-paste the line (do not shuffle but always keep adding them in the strict order from top to bottom: Acrobat keeps track of their numbers and sorts them internally), then start replicating blocks of lines until the page is full, copy-paste full pages in the Acrobat’s “Organize pages” tool, and then batch-rename everything.
  3. Back in ER: in the Format mode, add a PDF/File object and point it to your PDF template. Use the button Import / Update from PDF once to pull in field definitions. Don’t use “Update from PDF” again – it can scramble your mapping. Grouping fields by suffix (e.g., LineNo1..10) doesn’t always work automatically, so you might have to manually create a field group and drop in the core field (LineNo) without suffix.
  4. Apply ENUMERATE(Lines) to record lists to create a structure where @.Number gives you the index (1-based) and @.Value gives the record. Then, in the Mapping mode, set the Name property of the line field in the lower right corner to "LineNo"&TEXT(@.Number), then assign the value from @.Value.YourField as usual with the Bind button. By the way, the order of fields doesn’t matter – unlike Excel, where rows and columns are positional, the PDF is filled at once using a key-value approach (essentially, an FDF file).
  5. Don’t exceed the number of fields in your form. There’s no pagination or overflow – ER won’t split lines across multiple copies of the form. You may limit the data source with the formula like WHERE(@.LinesEnumerated,@.LinesEnumerated.Number<=10) to harden the report. You may also design a custom warning if the number of lines exceeds a certain threshold: Validate Electronic Reporting on execution and show errors or warnings – Arcadi Burria.

In short, ER’s PDF support is usable and powerful enough but static. With proper naming and field repetition strategy, it’s good for things like tax forms, returns, invoices with known limits, etc. The main challenge is preparing the template, not the mapping itself.

<GJ>2021</GJ>

“The more stitches, the less riches” from the “Brave New World” by Aldous Huxley

<GJ>2021</GJ>

Barely anyone closes the financial year faster than ER-Consult GmbH. 2021 could only be better than 2020. Indeed, together with Margarita and Chandan we pushed the revenue by 27%, the private equity grew by 34%. ER-Consult has become a forge for Configurable Business Documents and all things Electronic Reporting in Dynamics, with customers in Italy, France and the USA.

However, on the warmest 1st of January ever recorded, a small doubt is allowed whether an infinite growth is possible on a finite planet.

Auto-post inbound delivery notes in a batch

Auto-post inbound delivery notes in a batch

In order to register a manual or an OCR purchase invoice, the accountant should match the quantity against the delivery notes (en-us: packing slip) captured at the warehouse. But what if the inbound area is only equipped with mobile scanners? What if we do not have the carbon copy on hand, or just don’t care about the printed document at all? The shipment may be damaged or incomplete! Indeed, we should only pay for what we’ve physically received:
Register the actual quantity → Post the ‘Product receipt’ with that quantity → Match the invoice against the same → Claim the difference from the supplier, if any.

However, when registering the said delivery note against the purchase order with the Generate / Product receipt button or the respective periodic task, the user must provide the delivery note number as written by the supplier of the goods. This makes an automation with a batch job at the first glance impossible, because it requires human interaction.

Update product receipts

The automatic job Warehouse management / Periodic tasks / Update product receipts is the remedy. For every inbound load within the given constraints, it creates and posts a delivery note aka packing slip with the total registered quantity.
The inbound load does not necessary require any active management. The load may be…

  • Created manually out of the purchase order lines in the Load planning workbench
  • Imported from an ASN, but also
  • Added by the system automatically if the parameter Automatically create at purchase order entry is turned on


If the load is not confirmed, the Update product receipts will confirm it automatically first, then promote to the final status Received. The bogus delivery note number is like LOADID_N, where N is a running number. The quantity is the registered quantity versus the respective load line(s). It does not matter how the registration came about:

  • Mobile scanner PO line/item receiving or PO line/item receiving and put away
  • Mobile scanner License plate receiving or License plate receiving and put away [against an ASN]
  • Mobile scanner Load item receiving or Load item receiving and put away
  • Mobile scanner Mixed license plate receiving or Mixed license plate receiving and put away
  • the new simplified License plate receiving: license-plate-receiving-enhancements
  • the classic inventory Arrival journal
  • and last but not least, the classic Registration at the purchase order line level.

In essence, you just scan the last pallet of the PO and forget. At the end of the working day (or faster, depending on the batch job schedule) the system will process every In process load (i.e. where the receipt of at least one pallet has started) and make as many delivery notes as needed to update the purchase orders.

More on inbound loads

The only limitation is the use of the advanced Warehouse management processes at the warehouse, i.e. the inbound load may only be created at a WHS-enabled warehouse. More on inbound load handing here: https://docs.microsoft.com/en-us/dynamics365/supply-chain/warehousing/inbound-load-handling.

The recent features “Associate purchase order inventory transactions with load” and “Multiple product receipt postings per load” may be beneficial.