Skip to content

Vendor master data from an Excel list

You keep your vendor list in Excel: name, creditor account, payment terms in days and whether the vendor is blocked. Upload the XLSX file into a data table lieferanten with the name as its key column; for a new version of the list, simply upload it again. The script looks up the invoice’s vendor in the table and sets the creditor account and the day the invoice is payable by, two fields the workflow declares itself. It marks a blocked vendor with the tag “Prüfen”, and for a vendor missing from the list the approval gets a hint. When all you need per vendor is the cost center and the G/L account, a card is enough: Allocation from a data table.

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: 1
schemaVersion: 4
sdk: '1.0.0'
key: vendor-master-data
name: Lieferantenstammdaten aus der Lieferantenliste
template: custom
trigger:
documentType: incoming-invoice
fields:
- key: creditorAccount
kind: text
labelDe: Kreditorenkonto
labelEn: Creditor account
documentTypes:
- incoming-invoice
- key: paymentDue
kind: date
labelDe: Zahlbar bis
labelEn: Payable by
documentTypes:
- incoming-invoice
start: enrich
steps:
- kind: script
name: enrich
label: Stammdaten des Lieferanten
script: enrich.ts
hook: onDocumentArrived
inputs:
- kind: field
key: vendorName
type: text
- kind: field
key: invoiceDate
type: date
- kind: table
key: lieferanten
returns: []
exits: []
next: approve
- kind: humanTask
name: approve
label: Freigabe
taskKind: approve
assignees:
- when: null
assignee:
kind: costCenterResponsible
fallback:
kind: role
role: Buchhaltung
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

Hook: onDocumentArrived · Inputs: vendorName, invoiceDate, data table lieferanten · Return values: none

import { date, defineScript } from '@acriva/workflow-sdk';
export default defineScript({
hook: 'onDocumentArrived',
async run(ctx) {
const { vendorName, invoiceDate } = ctx.document.fields;
if (vendorName == null) return;
// The row whose key column (the vendor's name) holds the name, or null when the list has none.
const vendor = await ctx.tables.lookup('lieferanten', vendorName);
if (vendor === null) {
ctx.hint(
`„${vendorName}“ steht nicht in der Lieferantenliste. Bitte ergänzen Sie den Lieferanten in der Datentabelle Lieferanten.`,
);
return;
}
if (vendor.gesperrt) {
ctx.addTag('Prüfen');
ctx.hint(
`„${vendorName}“ ist in der Lieferantenliste gesperrt. Bitte klären Sie, ob die Rechnung bezahlt wird.`,
);
}
if (vendor.kreditorenkonto) ctx.setField('creditorAccount', vendor.kreditorenkonto);
if (invoiceDate != null && vendor.zahlungszielTage != null)
ctx.setField('paymentDue', date.addDays(invoiceDate, vendor.zahlungszielTage));
},
});

A test runs each of these cases in the sandbox and compares the result.

  • Input: vendorName Billig-Druck Ltd., invoiceDate 2026-10-15
  • Data table lieferanten: 3 rows
    • name Telekom Deutschland GmbH, kreditorenkonto 70012, zahlungszielTage 30, gesperrt false
    • name Bürobedarf Schmidt KG, kreditorenkonto 70044, zahlungszielTage 14, gesperrt false
    • name Billig-Druck Ltd., kreditorenkonto 70091, zahlungszielTage null, gesperrt true
  • Exit: the default next step
  • Changes: tag “Prüfen”; hint on the next task: “„Billig-Druck Ltd.“ ist in der Lieferantenliste gesperrt. Bitte klären Sie, ob die Rechnung bezahlt wird.”; field creditorAccount = 70091
  • Input: vendorName Telekom Deutschland GmbH, invoiceDate 2026-10-15
  • Data table lieferanten: 3 rows
    • name Telekom Deutschland GmbH, kreditorenkonto 70012, zahlungszielTage 30, gesperrt false
    • name Bürobedarf Schmidt KG, kreditorenkonto 70044, zahlungszielTage 14, gesperrt false
    • name Billig-Druck Ltd., kreditorenkonto 70091, zahlungszielTage null, gesperrt true
  • Exit: the default next step
  • Changes: field creditorAccount = 70012; field paymentDue = 2026-11-14
  • Input: vendorName Neue Firma AG, invoiceDate 2026-10-15
  • Data table lieferanten: 3 rows
    • name Telekom Deutschland GmbH, kreditorenkonto 70012, zahlungszielTage 30, gesperrt false
    • name Bürobedarf Schmidt KG, kreditorenkonto 70044, zahlungszielTage 14, gesperrt false
    • name Billig-Druck Ltd., kreditorenkonto 70091, zahlungszielTage null, gesperrt true
  • Exit: the default next step
  • Changes: hint on the next task: “„Neue Firma AG“ steht nicht in der Lieferantenliste. Bitte ergänzen Sie den Lieferanten in der Datentabelle Lieferanten.”