Email Vendor Remittance Job
This page documents the vendor remittance advice email job implemented by codeunit 73053604 lts_opsaEmailVendRemittance.
Purpose
The job sends vendor remittance advice by email with a PDF attachment generated from Report Selections for P.V.Remit.
Object And Entry Points
- AL object: codeunit 73053604 lts_opsaEmailVendRemittance
- Main runner: OnRun calls Process on lts_opsaEntry
- Waiting entry creation: InsertWaitingEntry(VendorLedgerEntryNo)
- Email sender: EmailVendorRemittance(VendorLedgerEntry, ToEmails)
Prerequisites
- App setting Enable Email Vendor Remittance Job is enabled.
- At least one active Operations Automation Setup exists for:
- Object Type to Run = Codeunit
- Object ID to Run = lts_opsaEmailVendRemittance
- Blocked = false
- Vendor email address exists (resolved by lts_opsaEMail.GetVendorEmailAddress).
- Report Selections for P.V.Remit. is configured.
- If needed, a Custom Report Selection layout is configured for the vendor.
How Waiting Entries Are Created
InsertWaitingEntry(VendorLedgerEntryNo) performs the following:
- Reads the vendor ledger entry record.
- Verifies the feature flag Enable Email Invoice Job.
- Finds matching setup records for this codeunit.
- Applies setup record filters against Vendor Ledger Entry No.
- Prevents duplicate waiting entries for the same setup and source record unless AllowReEntry(true) is used.
- Creates a new entry with:
- Description: To email remittance to: {Vendor No.} - {Document No.}
- Status: Waiting
Processing Flow
When the entry runs:
- Process resolves Source Record ID to Vendor Ledger Entry.
- EmailVendorRemittance builds email details:
- Subject: Vendor {Vendor No.}: Please find your remittance advice
- Body: HTML generated from selected report and layout; falls back to subject text.
- Attachment: PDF rendered from selected remittance report.
- Filename: {VendorNo}_{DocumentNo}_remittance.pdf
- Email is sent through lts_opsaEMail.SendEmail.
- A success log is created: Vendor remittance emailed: {ToEmails}.
Filtering Behavior
Setup-level record filters are evaluated against Vendor Ledger Entry and entry number. Only entries included by setup filters generate waiting entries.
Logging
- Success log status: Success
- Log message format: Vendor remittance emailed: {email list}
Common Failure Points
- To email address is blank for the vendor.
- Report selection for P.V.Remit. is not configured.
- Custom report layout configuration is invalid.
- Email scenario or sending account is not configured in Business Central.