Automatic Invoice Dispatch

Posted sales invoices are dispatched automatically via Pingen whenever codeunit PingenJobQueueVTO runs from a Job Queue Entry.

Which invoices qualify

An invoice is picked up by automatic dispatch when all of the following are true:

  1. It is not yet marked as processed (Processed = No).

  2. It was posted with the Pingen profile active — i.e. the bill-to customer had the configured Document Sending Profile at the moment of posting. That status is frozen into the internal Pingen Auto-Send flag at posting time and is immutable afterwards.

  3. The posting date is at least Send Days Delay days in the past.

Condition

Value

Processed

No

Pingen Auto-Send (frozen at posting)

Yes

Posting date

<= today − Send Days Delay

Important: Profile changes on the customer card do not affect already-posted invoices. To force or prevent dispatch of a posted document after the fact, use the Disable Pingen Sending / Enable Pingen Sending actions (see Enable and Disable Pingen Sending) or the Send via Pingen button for a one-off manual send.

What happens during a run

  1. The codeunit verifies that Client ID, Client Secret, Organisation ID, and the profile code are all set. If anything is missing, the run exits cleanly.

  2. It iterates over every posted sales invoice with Processed = No and Pingen Auto-Send = Yes.

  3. For each matching invoice, the PDF is rendered, uploaded, and the letter is created at Pingen.

  4. On success, Sent via Pingen at and Processed are updated and the change is committed.

  5. On failure for a single document, the error is caught, the document is skipped, and the run continues — the overall run does not abort.

Note: On failure, Processed stays No and the invoice is retried on the next run. Persistent errors (e.g. incomplete recipient address) should be fixed manually or marked with Disable Pingen Sending to take them out of the queue.

Field

Recommendation

Object Type to Run

Codeunit

Object ID to Run

70679759 (PingenJobQueueVTO)

Recurrence

Daily (e.g. 06:00) or every few hours

Max retries

As needed, e.g. 3

Tip: A daily run is enough for most scenarios — letters don't arrive within minutes anyway. If you need faster turnaround, schedule hourly runs.

Manual override

Even with automatic dispatch active, the Send via Pingen button stays available on posted invoices — handy for sending an invoice immediately without waiting for the next job queue run.

  • Send Documents Manually via Pingen

  • Enable and Disable Pingen Sending

  • Core Concepts — Posting-date delay