Complete e-invoice (calculation + PDF + ZUGFeRD)
The "Complete e-invoice (calculation + PDF + ZUGFeRD)" service task turns an invoice record into a finished e-invoice in one step: the amounts are calculated, the PDF is rendered from the stored HTML template, and the ZUGFeRD XML (Factur-X, profile EN 16931) is embedded into the PDF/A-3. One service task replaces four individual ones.
Technical name prio_generateCompleteEInvoice · Category in the "Select service task" dialog: Invoices & e-invoicing · Frequently used
When is this service used?
- Invoice from the record: Musterfirma GmbH stores invoices in the standard schema
app_invoices; after approval the process generates the e-invoice and attaches it to the record. - B2B e-invoicing: Business customers receive a PDF with embedded XML that any accounting software can import.
- Custom invoice schema: Invoices stored with custom field names are mapped to the standard via the field mapping, without changing existing data.
How it works
- Field mapping (optional): A custom invoice schema is translated into the
app_standard schema via the inbound mapping. - Calculation: Net, VAT and gross per line item and as totals, as in Calculate invoice amounts.
- Write-back (optional): Calculated totals and line values are written back into the custom fields.
- PDF: The HTML template is rendered with the invoice data (A4, Handlebars helpers available).
- ZUGFeRD: The invoice data is mapped to the ZUGFeRD format, the CII XML is generated and embedded as Factur-X into the PDF/A-3.
Input
Settings in the process designer
This service has its own PDF settings in the properties panel. The status card shows "PDF ready" once a template is stored, otherwise "PDF incomplete".
| Setting | Required | Meaning |
|---|---|---|
| Edit PDF template (HTML) | Yes | Opens the PDF Template Designer with the tabs "Template (HTML + Handlebars)" and "Sample data (JSON)" plus the preview ("Generate preview"). Without a template the PDF is empty. |
| Set filename | No | Name of the PDF file; placeholders $(fieldname) are resolved against the input, e.g. E-Invoice-$(app_invoice_no).pdf. Empty = document.pdf. A / in the result becomes -. |
| Set data mapping (JSONata) | No | JSONata expression evaluated against the input; the result is available in the template as content. Empty = the whole input. |
| Set field mapping | No | "Field mapping" dialog with Inbound mapping (JSONata) (custom schema → app_ standard, no calculation) and Write-back (JSON) (calculated values → custom fields). |
| PDF target field in invoice (optional) | No | Field name in the invoice object under which the PDF reference is stored additionally, e.g. app_invoice_pdf. Empty = PDF only under pdf. |
When the service is selected, the input expression is set to $, so the activity receives the whole message. If the invoice record sits in a sub-field, the input expression is changed accordingly, e.g. to $.invoice. All settings of the PDF settings work on the result of the input expression.
Invoice record
The input is the invoice record in the standard schema app_invoices. The calculation only needs the line items; a valid e-invoice additionally needs the remaining mandatory fields.
| Field | Type | Required | Meaning |
|---|---|---|---|
app_invoice_items_custom |
list | Yes (or app_invoice_items_articles) |
Line items with app_description, app_amount, app_unit, app_item_price_net, app_vat_percentage (0, 7 or 19), optional app_article_no, app_sublines |
app_invoice_no, app_invoice_date |
text | for e-invoice | Invoice number and date (YYYY-MM-DD) |
app_seller |
object | for e-invoice | Seller: app_seller_name, app_seller_street, app_seller_postcode, app_seller_city, app_seller_country, app_seller_vat_id or app_seller_tax_number, optional app_seller_iban, app_seller_bic, app_seller_contact_name, app_seller_contact_phone, app_seller_contact_email |
app_recipient |
object | for e-invoice | Recipient as resolved organization: document_name, main_address with street_address, post_code, city, country, optional email, vat_id, main_contact |
app_due_date, app_payment_method |
text | No | Due date; payment method invoice, direct_debit or prepayment – only then IBAN and BIC are taken from app_seller |
app_vat_rounding |
text | recommended | per_rate: VAT rounded per rate, see VAT rounding |
app_buyer_reference, app_order_reference, app_buyer_contact |
text / object | No | Routing ID (BT-10), purchase order number (BT-13), contact at the customer (BG-9) |
app_invoice_type, app_partial_invoices, app_skonto_percent, app_skonto_days |
text / list / number | No | Invoice type (invoice, credit_note, storno, partial, partial_construction, partial_final_construction, final_construction), partial invoices, early payment discount |
app_tax_mode, app_price_basis, app_simulation |
text | No | reverse_charge_13b; gross for gross prices; ja/yes sets the test indicator |
app_service_date, app_service_period_start, app_service_period_end |
text | No | Service date or period |
app_original_invoice or preceding_invoice_no, preceding_invoice_date |
object / text | No | Reference to the original invoice for cancellations and credit notes |
{
"app_invoice_no": "RE-2026-0042",
"app_invoice_date": "2026-11-10",
"app_due_date": "2026-11-24",
"app_payment_method": "invoice",
"app_vat_rounding": "per_rate",
"app_seller": {
"app_seller_name": "Musterfirma GmbH",
"app_seller_street": "Maximilianstraße 10",
"app_seller_postcode": "86150",
"app_seller_city": "Augsburg",
"app_seller_country": "DE",
"app_seller_vat_id": "DE123456789",
"app_seller_iban": "DE89370400440532013000",
"app_seller_bic": "COBADEFFXXX"
},
"app_recipient": {
"document_name": "Bäckerei Huber e. K.",
"main_address": { "street_address": "Bahnhofstraße 3", "post_code": "86391", "city": "Stadtbergen", "country": "DE" },
"email": "info@baeckerei-huber.example"
},
"app_invoice_items_custom": [
{ "app_description": "IT consulting", "app_amount": 8, "app_unit": "hour", "app_item_price_net": 120, "app_vat_percentage": 19 },
{ "app_description": "Network switch 24 port", "app_amount": 1, "app_unit": "piece", "app_item_price_net": 349, "app_vat_percentage": 19 }
]
}
Output
{
"invoice": {
"app_invoice_no": "RE-2026-0042",
"app_net_total": 1309.00,
"app_vat_total": 248.71,
"app_gross_total": 1557.71,
"app_amount_due": 1557.71,
"app_invoice_pdf": { "referenceId": "01JXXXXX", "filename": "E-Invoice-RE-2026-0042.pdf", "contentType": "application/pdf" }
},
"pdf": { "referenceId": "01JXXXXX", "filename": "E-Invoice-RE-2026-0042.pdf", "contentType": "application/pdf" }
}
invoice: the complete invoice record with all input fields and the calculated values (app_net_total,app_vat_total,app_gross_total,app_amount_due, amounts per VAT rate such asapp_net_nineteen). If a PDF target field in invoice is set, the PDF reference is additionally stored under that field (app_invoice_pdfin the example).pdf: the e-invoice as file object – PDF/A-3 with embedded Factur-X XML.
With the result path invoice_result the file is afterwards found under invoice_result.pdf and the calculated record under invoice_result.invoice, see Result path.
Errors and behavior
- Every error ends the step with an exception: an attached error boundary event catches it, otherwise the instance fails and the process owner receives an email, see Errors. There is no
status/messagereturn value. - Typical messages: "calcInvoice: invoice data is missing or invalid" (no line items), "Umsatzsteuer nicht bekannt: …" (VAT rate other than 0, 7 or 19), "pdfMapperConfig ist kein gültiges JSON", "invoiceFieldMapper: inbound mapping returned no result", "Failed to launch the browser after 3 attempts" (PDF rendering).
- The service has its own retry behavior for the PDF rendering; the central retry for transient errors does not apply here. Time limit: 900 seconds.
- In a dry run the service is not called; the input is validated against the schema and a sample output is inserted, see Dry run.
Example
Musterfirma GmbH invoices Bäckerei Huber e. K. for eight hours of IT consulting and a network switch.
- Configuration: Set filename →
E-Invoice-$(app_invoice_no).pdf; Edit PDF template (HTML) → the company's invoice template; PDF target field in invoice (optional) →app_invoice_pdf. Data mapping and field mapping stay empty because the record follows the standard schema. - Input expression:
$(prefilled); the message is the invoice record from the example above. - Result path:
invoice_result. - Output:
invoice_result.pdf.referenceIdpoints to the fileE-Invoice-RE-2026-0042.pdf,invoice_result.invoice.app_gross_totalis1557.71. - Next step in the process: A Database step stores
invoice_result.invoiceinapp_invoices(includingapp_invoice_pdf), then Send email to external recipients (own domain) sends the fileinvoice_result.pdftoapp_recipient.email.
Further invoice types and fields
- Invoices without VAT under Section 13b UStG (reverse charge) via
app_tax_mode, see Reverse charge (Section 13b UStG) in e-invoices. - Partial, partial final and final invoices via
app_invoice_type,app_partial_invoices, early payment discount viaapp_skonto_percentandapp_skonto_days, see Partial and final invoices, early payment discount. - Labor costs for private customers (Section 35a EStG) via the labor share and
app_show_labor_cost, see Labor costs (Section 35a EStG). - For valid e-invoices set
app_vat_roundingtoper_rate; the previous rounding method will be removed on January 1, 2027. - Purchase order number (
app_order_reference, BT-13) and contact (app_buyer_contactwithapp_buyer_contact_name,_phone,_email, BG-9) only appear in the XML when filled; ifapp_buyer_contactis empty, the recipient'smain_contactis used. The sources are never mixed. - Cancellations and credit notes reference the original invoice from
app_original_invoiceorpreceding_invoice_noandpreceding_invoice_date.
Frequently asked questions
When are the individual steps calculation, PDF, ZUGFeRD mapping and e-invoice the better choice?
Only when custom logic is needed between the steps, e.g. an approval between calculation and PDF. For the standard case the complete service is shorter and delivers the same result.
Why are IBAN and BIC missing in the XML?
They are taken from app_seller only when app_payment_method is invoice, direct_debit or prepayment. Fields such as app_iban at invoice level are not read.
How does a payment QR code get onto the invoice?
In the template with the helpers qrCode and buildString, e.g. {{{qrCode (buildString "BCD\n002\n1\nSCT\n" app_seller.app_seller_bic "\n" app_seller.app_seller_name "\n" app_seller.app_seller_iban "\nEUR" app_gross_total "\n\n\nInvoice " app_invoice_no)}}} as src of an <img>, see Handlebars helpers.
Next step
Data in the process: how input expression, output expression and result path work together.