# Apply credit memo to invoice

The **Apply Credit Memo to Invoice** function automatically applies open customer credit memos to open invoices of the same customer, closing the entries in a single batch run instead of applying them manually from the customer ledger entries.


Search for **Apply Credit Memo to Invoice** using the Business Central search (Alt+Q). It is a batch job: it does not produce a printout.


| Field | Description |
|---|---|
| Posting Date (filter) | Required. Limits the credit memos to process by posting date. |
| Credit Memo No. Series | Optional. Processes only credit memos with this number series (or series filter). |
| Invoice No. Series | Optional. Considers only invoices with this number series (or series filter). |

Option values are remembered for the next run.


1. Open **Apply Credit Memo to Invoice**.
2. Set the **Posting Date** filter for the credit memos.
3. If needed, enter **Credit Memo No. Series** and **Invoice No. Series**.
4. Select **OK**. During processing, the customer, credit memo and invoice being applied are shown.
5. At the end, a message shows the number of credit memos applied.


For each open credit memo in the selected period, the job looks for an invoice of the same customer that:

- is open and not on hold (**On Hold** field empty);
- has the **same posting date** as the credit memo;
- has a remaining amount equal to or greater than the credit memo's;
- belongs to the specified invoice number series, if any.

An invoice with the same **due date** as the credit memo is preferred; if none is suitable, invoices with a different due date are also considered. Among valid invoices, the one with the highest remaining amount is chosen.

The credit memo is applied for its full remaining amount: the credit memo is closed and the invoice remains open for any difference. Credit memos for which no suitable invoice is found are skipped and remain open.

If the posting date filter is not set, the job stops with the message "Date filter must have a value".