Automatic Entity Linking
Customer Documents can link files to orders, invoices, shipments and credit memos by matching their filenames to configured entity patterns. Linked files then appear in the corresponding customer sales view.
Configure a pattern
Open Stores > Configuration > MageB2B > Customer Documents > Link Documents.
- Enable automatic linking.
- Add a pattern for the entity type — the configuration placeholder shows the concrete syntax, for example
order-{increment_id}.pdfmatchesorder-000000123.pdfto order 000000123. - Decide whether customers should see a message when an entity has no linked documents.
- Upload files whose names follow the pattern.
- Test with one known entity before processing a larger file set.
The daily link_customer_documents job performs the matching at 03:00. The file must already exist as a Customer Documents record and its name must match the configured result.
Access still applies
A link controls where the document is presented. Website scope, customer access, validity, password and download limits still govern the download.
If a link is missing
- Compare the stored filename with the exact pattern result.
- Confirm the correct entity type and increment value.
- Check that Magento cron completed the linking job.
- Review Magento logs for matching or repository errors.
- Test access as the customer who owns the order, invoice, shipment or credit memo.
Use Background Jobs for the schedule overview.