Share via

In Business Central , we like to add a line for retention and receive this message

SCHUMACHER, Sigrid - TE DE 60 Reputation points
2026-06-15T14:43:54.3033333+00:00

The Sales Line does not exist. Identification fields and values: Document Type='Invoice',Document No.='S_INV2600019',Line No.='20000'

Microsoft 365 and Office | Install, redeem, activate | For business | Other
0 comments No comments

Answer accepted by question author

AI answer

2026-06-15T14:44:11.39+00:00

The error indicates that Business Central (Dynamics NAV/Business Central platform) cannot find the Sales Line record for the specified document and line number when adding or processing the retention line. This class of error is known from Dynamics NAV 2009 as a missing line within the current filter or temporary buffer when copying or processing document lines.

In similar NAV 2009 scenarios, the fix is implemented in code by ensuring that, before accessing a line, the system:

  1. Copies the filters from the current record to the source line table.
  2. Sets the appropriate ranges (for example, "Document Type" and "Document No.").
  3. Uses a safe find method (FINDFIRST or FINDSET) and exits gracefully if no line is found, instead of assuming a line exists.

For example, the pattern used in NAV to avoid “There is no Sales Invoice Line within the filter” errors is:

TempSalesCrMemoLine.SETRANGE("Document No.", "Document No.");
IF NOT TempSalesCrMemoLine.FINDFIRST THEN BEGIN
    SalesCrMemoLine.COPYFILTERS(Rec);
    SalesCrMemoLine.SETRANGE("Document No.", "Document No.");
    IF NOT SalesCrMemoLine.FINDFIRST THEN
        EXIT(FALSE);
    TempSalesCrMemoLine := SalesCrMemoLine;
    TempSalesCrMemoLine.INSERT;
END;

or, when using FINDSET:

TempReturnShptLine.SETRANGE("Document No.", "Document No.");
IF NOT TempReturnShptLine.FINDFIRST THEN BEGIN
    ReturnShptLine.COPYFILTERS(Rec);
    ReturnShptLine.SETRANGE("Document No.", "Document No.");
    IF NOT ReturnShptLine.FINDSET THEN
        EXIT(FALSE);
    TempReturnShptLine := ReturnShptLine;
    TempReturnShptLine.INSERT;
END;

To resolve the retention-line error in Business Central, the same principle must be applied in the extension or customization that adds/handles the retention line:

  1. Locate the codeunit/page extension that creates or processes the retention line for Sales Invoices.
  2. Identify where it reads from Sales Line (or a temporary Sales Line buffer) for the invoice S_INV2600019 and line 20000.
  3. Replace any direct FIND('-') or similar calls that assume a line exists with a guarded pattern:
    • Set the filters (Document Type, Document No., and any other relevant filters such as Line No.).
    • Use FINDFIRST or FINDSET.
    • If no line is found, exit the function or handle the condition instead of continuing and causing the “Sales Line does not exist” error.

Because this is a code-level issue, the concrete fix must be implemented by a Business Central developer or partner, following the safe-find patterns shown in the NAV 2009 hotfixes.


References:

AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.