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

manuelgruber100
Member Posts: 2
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.

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!
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.

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!

1
Answers
-
[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!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions