Error: An attempt was made to change an old version of a “Sales Line” record

When posting e.g. a Warehouse Shipment or an other document concerning direct or indirect table “Sales Line”, then following error can occur:

An attempt was made to change an old version of a “Sales Line” record. The record should first be reread from the database. This is a programming error. Identification fields and values: …

Technical Detail:
This error occurs, when “Sales Line”.modify is called.

Reason:
The code was customized. Along the call chain the same “Sales Line” record is modified before the call, where the error occurs. That means there is a customized code (maybe in CU 80 or table “Sales Line”), where some fields are changed, then “Sales Line”.modify is called. After that “Sales Line”.modify is called a second time. That is not allowed.

Solution:
If you did not change the code by yourself, contact the colleague, who made the last changes or contact your NAV Partner. First challenge is to find the position, where “Sales Line”.modify is called first.
Hint: Debug the function, which causes the error and set a breakpoint into trigger OnModifyDatabase in CU 1. This trigger is called each time command modify is called.
When the position is found, change the code. If possible remove the first “Sales Line”.modify call.
Other solution: Reload the “Sales Line” record at the second position (where the error occurs) before calling modify with GET, then write the needed field changes, then call modiy.

cheers

2 thoughts on “Error: An attempt was made to change an old version of a “Sales Line” record

Leave a comment