Allocation from a data table
Before an incoming invoice goes to approval, the Set field step with “Take values from a data table” sets its cost center and G/L account from the data table kostenstelleJeLieferant: from the row whose key is the invoice’s vendor, with no script. It creates the one allocation line only on an invoice without an allocation, never over a person’s and never on an invoice already exported. Without a row the invoice stays as it is, and the history says so.
The workflow
Section titled “The workflow”The workflow starts for every document of the type incoming-invoice. Its file workflow.yaml:
$schema: 'https://docs.acriva.de/schemas/workflow.schema.json'format: 1schemaVersion: 7sdk: '1.0.0'key: cost-center-from-tablename: Kontierung aus Datentabelletemplate: customtrigger: documentType: incoming-invoicefields: []start: allocatesteps: - kind: setField name: allocate label: Kontierung aus Datentabelle assignments: - field: invoice.costCenter source: tableLookup lookup: table: kostenstelleJeLieferant keyField: vendorName column: kostenstelle - field: invoice.glAccount source: tableLookup lookup: table: kostenstelleJeLieferant keyField: vendorName column: sachkonto next: approval - kind: humanTask name: approval label: Freigabe taskKind: approve assignees: [] fallback: kind: role role: Geschäftsführung options: excludeRequester: true excludeActorsOfSteps: [] pickFile: false next: approved onRejected: rejected - kind: end name: approved label: Freigegeben outcome: approved - kind: end name: rejected label: Zurückgewiesen outcome: rejected