1

The rule AA0242 is giving a false positive for such example:


                   // Get next Line No.

                   ServiceLine2.Reset();

                   ServiceLine2.SetRange("Document Type", ServiceLine."Document Type");

                   ServiceLine2.SetRange("Document No.", ServiceLine."Document No.");

                   ServiceLine2.SetLoadFields("Line No.");

                   if ServiceLine2.FindLast() then

                       LineNo := ServiceLine2."Line No." + 10000

                   else

                       LineNo := 10000;


                   // Insert new Line

                   ServiceLine2.Reset(); // Note: this resets SetLoadFields to all fields (according to documentation of "Reset")

                   ServiceLine2.Init();

                   ServiceLine2."Document Type" := ServiceLine."Document Type";

                   ServiceLine2."Document No." := ServiceLine."Document No.";

                   ServiceLine2."Line No." := LineNo;

                   ServiceLine2.Validate("Service Item Line No.", ServiceLine."Service Item Line No.");


warning AA0242: Field 'Service Item Line No.' is not selected for loading and accessing it may cause a JIT load.


Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team