---
id: change/bcquality/275
type: change
title: "#275 knowledge(performance): Get behind a key-is-set check in and-condition wastes a DB call"
summary: 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.
tier: official
language: en
tags:
  - feature
  - main
system: development
review:
  state: reviewed
  by: opus
  at: "2026-11-23T00:56:58.962Z"
  flags: []
generated:
  at: "2026-11-23T00:15:10.597Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 398bece9cc0c50ef1e061fa53b3c907bbd6d9479
evidence:
  - kind: code
    url: https://github.com/microsoft/BCQuality/pull/275
    title: "microsoft/BCQuality#275: knowledge(performance): Get behind a key-is-set check in and-condition wastes a DB call"
    date: "2026-11-18"
    commit: 398bece9cc0c50ef1e061fa53b3c907bbd6d9479
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines:
    - guideline/microsoft/knowledge/performance/boolean-operators-do-not-short-circuit
  changes: []
number: 275
repo: microsoft/BCQuality
source_id: bcquality-prs
url: https://github.com/microsoft/BCQuality/pull/275
kind: pr
base_branch: main
major: null
merged_at: "2026-11-18T09:17:46Z"
author: pri-kise
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: feature
behavior_change: false
breaking: false
files:
  count: 3
  additions: 27
  deletions: 2
  al: 3
apps: []
objects_touched: []
objects_unjoined:
  - path: microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.bad.al
    status: modified
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.good.al
    status: modified
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.md
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - development
  - platform
quote: null
joined_against:
  major: null
  commit: null
---

# #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](https://github.com/microsoft/BCQuality/pull/275) · 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

- `microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.bad.al`: modified, not in the BC? snapshot
- `microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.good.al`: modified, not in the BC? snapshot
- [`microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.md`](../../guidelines/microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.md): modified, not in the BC? snapshot

## 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).
