code change · featureAL Developmentofficial - Microsoftreviewed - checked by Opus

#275 knowledge(performance): Get behind a key-is-set check in and-condition wastes a DB call

The boolean-operators-do-not-short-circuit article now covers Record.Get placed behind a key-is-set check in an and-condition. The pattern is not unsafe, but the Get is an unnecessary call when the guard means the key is not set.

Pull request · merged into main on 2026-11-18 by pri-kise · 3 files (+27 -2), 3 AL · feature · tier official · reviewed (checked by Opus)

What changed

  • New anti-pattern signal: Rec.Get(Key) behind Key <> 0 or Key <> ‘’ when only a field value or default is returned
  • Best practice: exit early with a guard clause, then call Get
  • Get may be served from the server cache, so it is not always a database round-trip
  • GetEntryDescription samples added to the bad and good files, both using SetLoadFields(Description)
  • The existing article was extended instead of adding a new one

AL objects touched

Context

  • Systems: development, platform

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).