bcquality/community/knowledge/performance/pass-var-record-to-preserve-partial-load-enumerator.bad.al
Stefano Demiliani ebceff2332 knowledge(performance): add community rules for JIT, locks, and false positives
These articles capture BC-specific mechanics agents still invert: partial-record JIT on writes, Reset clearing SetLoadFields, HttpClient inside write transactions, and batched number series, plus negative guidance that stops over-eager Query and IsEmpty "fixes".

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 15:57:58 +02:00

20 lines
583 B
AL

codeunit 50100 "Pass Var Enumerator Bad"
{
procedure ListUsCustomerCities()
var
Customer: Record Customer;
begin
Customer.SetLoadFields(Name);
Customer.SetRange("Country/Region Code", 'US');
if Customer.FindSet() then
repeat
// By-value copy: JIT on City does not update the enumerator.
Message(Customer.Name + ' ' + CityOf(Customer));
until Customer.Next() = 0;
end;
local procedure CityOf(Customer: Record Customer): Text
begin
exit(Customer.City);
end;
}