Appearance
A per-row document artifact generator
When you need this
"Generate a document per completed record and stash the file" — an audit report per finished audit, a handover certificate per completed checkout. Zero Java — one entity_document_generator_config row run by engine-entity.document-generator.
The file
metadata/seed-data/office-equipment-document-configs.json:
json
{
"entity": "entity_document_generator_config",
"keyFields": ["document_code"],
"source": "office-equipment",
"rows": [
{
"document_code": "equipment-audit-report",
"source_entity": "oeq_audit",
"when_status_in": "COMPLETED",
"target_file_field": "report_file_ref_id",
"format": "json",
"cabinet_id": 42,
"child_entity": "oeq_audit_item",
"child_match_field": "audit_id",
"file_name_template": "equipment-audit-${id}-${date}.json",
"active": true
}
]
}How to read it
For each oeq_audit in status COMPLETED that doesn't already have a file reference in report_file_ref_id (a text column — its non-blank state is the dedupe marker), the job builds a structured document from the audit row plus its oeq_audit_item children, stores it in DMS cabinet 42, and writes the file id back into report_file_ref_id.
The limitation to know
The platform's PDF render path only renders synthetic sample data via the Studio app — it can't be driven headless against a real record. So this job emits a structured-data artifact (json or csv), not a rendered PDF. template_ref is reserved for when real-record binding ships.
Also ship
cabinet_idmust be a real DMS cabinet id in your tenant.- The shared
entity_document_generator_config.json(additive) and anAFTER_CREATEregister rule callingensureEntityDocumentGeneratorJobRegistered.
Related
erp examples patterns --kind jobs→per-row-document-artifact-generation