Changes to record cannot be saved because some information on the page is not up-to-date

manuelgruber100manuelgruber100 Member Posts: 1
edited 2024-09-25 in NAV Three Tier
Hello,

In the "Item Variants" page we have a customized field "Packsation" - "Packtisch". By validating or changing this field, the new value should also be updated on the "Packstation" field on the "Sales Line" table.
p927c15rooql.png
The error occurs in the Item Variants page and not in the Sales Order Subform page


Therefore, I have this code in the OnValidate trigger of the table:

trigger OnValidate()
var
SalesOrderLineMgmt: Codeunit "Sales Order Line Management";
begin
if Rec.Packstation <> xRec.Packstation then
SalesOrderLineMgmt.UpdatePackstation(Rec."Item No.", Rec.Code, Packstation);
end;



The UpdatePackstation will do the changes on the Sales Lines:
procedure UpdatePackstation(ItemNo: Code[20]; ItemVariantCode: Code[20]; NewPackstation: Enum "ACH Packstation")
var
SalesLine: Record "Sales Line";
begin
SalesLine.SetCurrentKey("Document Type", Type, "No.", "Variant Code", "Is Weighed", "Location Code", "Shipment Date");
SalesLine.SetRange("Document Type", SalesLine."Document Type"::Order);
SalesLine.SetRange(Type, SalesLine.Type::Item);
SalesLine.SetRange("No.", ItemNo);
SalesLine.SetRange("Variant Code", ItemVariantCode);
SalesLine.SetRange("Is Weighed", false);
SalesLine.SetRange("Location Code", BKLbl);
SalesLine.SetFilter("Shipment Date", '%1..', Today());

SalesLine.ModifyAll(Packstation, NewPackstation, false);
end;



The problem is this error only occurs directly in customers system environment and due to this, it's not possible to recreate this error locally or in development environment. Maybe the reason is the fact that multiple users a working parallely.

How can I solve this problem? By using a Tablelock maybe?

Thank you in advance! :smile:

Answers

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'General Chat' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.