We have orders with multiple order lines in D365FO which are not correctly displayed in our template. If you look at the screenshot you see that there are also conversion errors in the document.
Are you able to assist us with this?
This happens because almost all bindings in the SalesInvoiceTmp list were wrong. When you list the lines, you want to refer to the field from the current line and not from all the lines in the list.
Binding to all fields in the list (wrong):
As a result (image below), all the string fields (marked yellow) from all the lines were concatenated, while the non-string fields (marked blue) couldn’t be concatenated and you got the conversion error as a result:
Binding to a field from the current line (correct):
Please note the binding in the expression editor. When MainData is selected as the binding source inside a List element, this will most likely result in either concatenated values or conversion errors:
But if you select Data Context as the binding source, this would lead to correct results:
There were more invalid bindings at the bottom of the document:
I corrected them as well. Here is a bit different situation than in a list. In a list we have a context of the current line (specified by Data Context), while here we are configuring a top-level element (not a child of some list), so that element “sees” all the lines in your datasource, but (again) we don’t want the fields from all the lines, but only from one of them, so the easiest way to solve this is to take the field from the first line ():
Please let me know if the results are now as expected?