XRechnung field assignment
A field assignment writes a value into an XRechnung field that Business Central does not fill by itself - the payee of a factored invoice, a third address line, a note on an invoice line. You pick the target field from the catalogue the generation endpoint publishes, say where the value comes from, and the app writes it into the payload it sends. No code and no change to the standard mapping.
Field assignments are set up on the DEXPRO eInvoice Field Assignments page. Everything they do to a document is recorded on the Payload provenance.
{add screenshot of DEXPRO eInvoice Field Assignments here}
The field catalogue
The catalogue is the list of fields the generation endpoint currently accepts. It is downloaded from the endpoint, so it follows the endpoint rather than the app. Open it from the eInvoice Sender Setup page with XR Field Structure, or from the field assignments with Field Catalogue.
- XRechnung Field Path - the field, written as a dotted path such as
payee.nameorinvoiceLines.note. This path is what an assignment targets. - Description - what the endpoint says the field is for.
- Is Required - whether the endpoint requires the field.
- Level - Header or Line. It follows from the path: everything under
invoiceLines.is written once per invoice line, everything else once per document. - Filled by Standard - whether Business Central already fills the field without any configuration. A field that is neither filled here nor assigned stays empty in the e-invoice.
- Assigned - whether an active field assignment writes it.
Actions: Assign Field creates an assignment for the selected field and opens its card, Field Assignments opens the list, Create Extension downloads a small AL extension that calculates the value in code, and Refresh Field Catalogue fetches the field list from the endpoint again. Use the refresh after the endpoint has added fields; it touches nothing but this list.
Which fields can be assigned
Two kinds of field are refused, and both are refused while you are setting the assignment up rather than when a document is exported.
- Required and already filled. A field the endpoint requires and Business Central already fills is protected: "… is required by the endpoint and is already filled from Business Central. It cannot be assigned, because a wrong value there would change what the recipient is invoiced without anybody noticing." A required field the app does not fill stays open - that is the field an assignment is most often needed for.
- Repeated groups. Allowances, charges, the VAT breakdown, preceding invoice references, item attributes and classifications are repeated groups whose entries answer to no single Business Central record: "… lies inside a repeated group whose entries do not correspond to Business Central records, so there is no record an assignment could read. Only header fields and invoice line fields can be assigned."
A path that is not in the catalogue is refused as well: "… is not a field of the current endpoint. Download the field catalogue and pick a field from the list." Refresh the catalogue if you expect a field the endpoint has recently added.
Setting an assignment up
{add screenshot of DEXPRO eInvoice Field Assignment here}
The card has four groups.
General
- Code - identifies the assignment.
- Description - what it is for.
- Active - whether the assignment is used. An assignment is only ever applied while this is on.
Target Field
- XRechnung Field Path - the field to write, chosen from the catalogue.
- Field Description, Level, Required by the Endpoint, Filled by Business Central - what the catalogue knows about the target. All four are read-only.
- Overwrite Standard - whether the assignment replaces a value Business Central has already produced. Off by default: the assignment then only fills the field if it is empty.
When It Applies
- All Document Types / Document Type - every exported document type, or a single one.
- Condition Rule Group - the rule group that decides whether the assignment applies to a document. Empty means it always applies. Set it up with the Condition Rules action; the rule group is created the first time you open it.
- Rule Set Code - the rule set the condition and value rules belong to, such as
EINV-SALESINVOICE-H. It follows from the document type and the level and cannot be picked by hand, because a rule is always evaluated against one table: the posted header for a header assignment, the posted line for a line assignment. - Rules Can Be Used - whether this assignment can carry rules at all. "Rules are evaluated against one table, so this assignment has to name a single document type. Switch All Document Types off and pick one."
- Priority - the order in which assignments on the same field are tried.
Use Rule Set Tables to add the related tables a rule may read, such as the customer, the vendor or the item.
Value
Source Type decides where the value comes from, and the fields below it follow the choice:
- BC Field - a field of the document, or of a table the document points at. Pick Source Table No. and Source Field No.; the captions beside them show what you picked. When the table is not the document itself, the app reaches it through the first field of the document that relates to it - which is how Customer, Vendor, Item or Salesperson are reached without you having to describe the path. Dates and amounts are formatted the way the payload sends them.
- Constant - a fixed value, entered in Constant Value.
- Rule - the value comes from the first rule that matches, out of the group set up with the Value Rules action. Each rule carries the field eInvoice Assigned Value on its card; that value is what is written.
- Calculation - an extension supplies the value by subscribing to OnResolveAssignmentValue. See Extensibility (developers).
A blank value is never written. An empty element in an e-invoice is worse than an absent one - the validator rejects it - so an assignment whose source yields nothing simply leaves the field alone.
Several assignments on one field
More than one assignment may target the same field: one per document type, or staggered by condition. They are tried in Priority order, and the first one whose condition holds and which yields a value wins.
An assignment that does not fire leaves the field open for the next one - whether its condition did not match, its source was empty, or its source record could not be reached. An assignment that is refused because the standard already filled the field settles the field: no later assignment tries it.
The assignments shipped with the app
The app ships thirteen ready-made assignments. They are the fields the endpoint offers, that may be assigned, and that Business Central cannot fill by itself - finding those among the paths of the catalogue is the fiddly part of setting an assignment up. They arrive inactive and without a value: point a row at its source and switch it on, rather than switching off the twelve you do not need.
| Code | Field | What it is |
| PAYEE-NAME | payee.name | BT-59 Payee name - needed when payment does not go to the seller |
| PAYEE-ID | payee.identifier | BT-60 Payee identifier |
| PAYEE-ID-SCHEME | payee.identifierSchemeIdentifier | Scheme of BT-60, from the ISO/IEC 6523 code list |
| PAYEE-LEGAL-ID | payee.legalRegistrationId | BT-61 Payee legal registration identifier |
| PAYEE-LEGAL-SCHEME | payee.legalRegistrationIdSchemeIdentifier | Scheme of BT-61, from the ISO/IEC 6523 code list |
| SELLER-ADDRESS-3 | seller.postalAddress.addressLine3 | BT-37 Seller address line 3 - Business Central has only two |
| BUYER-ADDRESS-3 | buyer.postalAddress.addressLine3 | BT-37 Buyer address line 3 - Business Central has only two |
| DELIVERY-ADDRESS-3 | deliveryInformation.deliverToAddress.addressLine3 | BT-165 Deliver to address line 3 - Business Central has only two |
| TAX-REP-ADDRESS-3 | sellerTaxRepresentativeParty.postalAddress.addressLine3 | BT-164 Tax representative address line 3 - Business Central has only two |
| LINE-NOTE | invoiceLines.note | BT-127 Invoice line note - free text about this line |
| LINE-ORDER-LINE | invoiceLines.referencedPurchaseOrderLineReference | BT-132 Referenced purchase order line - from the buyer's own order |
| LINE-PRICE-DISCOUNT | invoiceLines.priceDetails.priceDiscount | BT-147 Item price discount included in the gross price |
| LINE-GROSS-PRICE | invoiceLines.priceDetails.grossPrice | BT-148 Item gross price - needed beside BT-147, which is subtracted from it |
Restore Default Assignments brings them back: the ones that were deleted are created again, and the ones that are still there get their shipped target and description back. Your own assignments are not touched, and a shipped assignment you switched on and pointed at a field keeps both.
LINE-GROSS-PRICE is the only shipped assignment with Overwrite Standard switched on. Business Central sends the gross price equal to the net price, so an assignment that may not replace it could never write anything.
What an assignment needs beside it
A field assignment creates the groups along its path, so a single assigned field can bring a whole business group into being that the document has no other content for - and the validator then rejects the invoice over the empty elements left in it. When you switch such an assignment on, the app says so:
- A payee field without the payee name. "The endpoint always writes the payee name, so a payee without one leaves an empty element behind and the invoice is rejected." The hint stops once PAYEE-NAME is active as well.
- A price discount without the gross price. "The gross price is sent equal to the net price, so a price discount on its own breaks the rule that the net price is the gross price less the discount. The app ships an assignment for the gross price." Switch LINE-GROSS-PRICE on beside it and give it the gross price.
- The seller tax representative. "An assignment to … creates a seller tax representative on every document it applies to. Where the document has none, its name, country and VAT identifier stay empty and the invoice is rejected. Give the assignment a condition that picks the documents that have one."
These are hints, not refusals. Whether the companion is really needed depends on the documents the assignment applies to, and only you know those - a tax representative address line is correct on a document that has a tax representative.
Testing an assignment
Test Assignment runs one assignment against a posted document you pick; Test All Assignments runs every active one, which is where you see an assignment quietly losing a field to another with a higher priority. Nothing is sent, stored or logged.
{add screenshot of Test Field Assignments here}
The result shows the same rows the real run would record - what would be written, what it would replace, and every assignment that would do nothing, with the reason. The reasons are plain: the condition rule group matched no rule, the value rule group matched no rule, the source value is empty, the source table could not be reached from this document, no subscriber of OnResolveAssignmentValue supplied a value, or the field was already filled by the standard mapping and this assignment may not override it.
If no assignment applies at all, the page says so: "No field assignment applies to this document. Nothing would be written, and nothing would be skipped."
Related
- Payload provenance - what the assignments did to a document that was actually generated.
- Artifacts (GoBD audit history) - the generated e-invoice the provenance belongs to.
- Extensibility (developers) - supplying a value from code.
No comments to display
No comments to display