Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
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:
- Copies the filters from the current record to the source line table.
- Sets the appropriate ranges (for example,
"Document Type"and"Document No."). - Uses a safe find method (
FINDFIRSTorFINDSET) 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:
- Locate the codeunit/page extension that creates or processes the retention line for Sales Invoices.
- Identify where it reads from
Sales Line(or a temporarySales Linebuffer) for the invoiceS_INV2600019and line20000. - 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 asLine No.). - Use
FINDFIRSTorFINDSET. - If no line is found, exit the function or handle the condition instead of continuing and causing the “Sales Line does not exist” error.
- Set the filters (
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:
- "Sales Invoice Line: There is no Sales Invoice Line within the filter" error message when you run the "Get Posted Document Lines to Reverse" function in Microsoft Dynamics NAV 2009
- "Sales Invoice Line: There is no Sales Invoice Line within the filter" error message when you run the Get Posted Document Lines to Reverse function for an order in Microsoft Dynamics NAV 2009
- "There is no Sales Invoice Line within the filter. Filters: Document No.: [Document_Number]" error message when you reject a posted bill group in the Portuguese version of Microsoft Dynamics NAV
- Error message when you use the "Copy document" function to create a new invoice in the Portuguese version of Microsoft Dynamics NAV 2009 SP1 or in the Portuguese version of Microsoft Dynamics NAV 5.0 SP1