---
id: change/bcquality/290
type: change
title: "#290 Attachment cleanup by document type"
summary: Quality guidance added for Business Central 29 on scoping attachment cleanup by document type in sales headers, since quotes and orders can share the same number.
tier: official
language: en
tags:
  - feature
  - main
system: development
review:
  state: reviewed
  by: opus
  at: "2026-11-30T15:07:53.891Z"
  flags: []
generated:
  at: "2026-11-30T13:33:07.232Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 02994d82a9490163d3fcbc865fa4d816a5037970
evidence:
  - kind: code
    url: https://github.com/microsoft/BCQuality/pull/290
    title: "microsoft/BCQuality#290: Attachment cleanup by document type"
    date: "2026-11-30"
    commit: 02994d82a9490163d3fcbc865fa4d816a5037970
    t: null
    quote: A quote and an order can share a number, so filtering only by table ID and number can delete another document's attachments.
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines:
    - guideline/microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type
    - guideline/microsoft/skills/review/al-data-modeling-review
  changes: []
number: 290
repo: microsoft/BCQuality
source_id: bcquality-prs
url: https://github.com/microsoft/BCQuality/pull/290
kind: pr
base_branch: main
major: null
merged_at: "2026-11-30T09:38:43Z"
author: fernandoartalf
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: feature
behavior_change: false
breaking: false
files:
  count: 5
  additions: 68
  deletions: 3
  al: 4
apps: []
objects_touched: []
objects_unjoined:
  - path: microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.bad.al
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.good.al
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.md
    status: added
    reason: not-in-snapshot
  - path: microsoft/skills/review/al-data-modeling-review.md
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - development
quote: A quote and an order can share a number, so filtering only by table ID and number can delete another document's attachments.
joined_against:
  major: null
  commit: null
---

# #290 Attachment cleanup by document type

> Quality guidance added for Business Central 29 on scoping attachment cleanup by document type in sales headers, since quotes and orders can share the same number.

[Pull request](https://github.com/microsoft/BCQuality/pull/290) · merged into `main` on 2026-11-30 by fernandoartalf · 5 files (+68 -3), 4 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- New quality rule guidance for BC 29 addressing attachment cleanup scope
- Clarifies that filtering by only table ID and number can inadvertently delete another document's attachments
- Provides good and bad code examples with documented exceptions for intentional cross-type cleanup
- Updates review routing and test fixture coverage
- References attachment management and external storage sources

## AL objects touched

- `microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.bad.al`: added, not in the BC? snapshot yet
- `microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.good.al`: added, not in the BC? snapshot yet
- [`microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.md`](../../guidelines/microsoft/knowledge/data-modeling/scope-sales-header-attachment-cleanup-by-document-type.md): added, not in the BC? snapshot yet
- [`microsoft/skills/review/al-data-modeling-review.md`](../../guidelines/microsoft/skills/review/al-data-modeling-review.md): modified, not in the BC? snapshot

## Context

- Systems: development
- From the description: "A quote and an order can share a number, so filtering only by table ID and number can delete another document's attachments."

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