---
id: change/bcapps/10210
type: change
title: '#10210 [Bug][Subscription Billing] "Delete Invoiced Sales Orders" leaves orphaned Sales Subscription Lines behind'
summary: Fixed orphaned Sales Subscription Lines left behind by "Delete Invoiced Sales Orders" and "Delete Invd Blnkt Sales Orders" reports by adding event subscribers and batch deletion procedures on the Sales Header table extension.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit sales subscription line mgmt.
  - tableextension sales header
  - tableextension sales line
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:02:32.369Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 2931bac2bb8cf7ad63905238b16d2e7da5184784
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10210
    title: 'microsoft/BCApps#10210: [Bug][Subscription Billing] "Delete Invoiced Sales Orders" leaves orphaned Sales Subscription Lines behind'
    date: "2026-10-02"
    commit: 2931bac2bb8cf7ad63905238b16d2e7da5184784
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/8069
    - object/tableextension/8053
    - object/tableextension/8054
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10210
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10210
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-02T22:34:03Z"
author: miljance
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - "AL: Apps (W1)"
  - From Fork
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 4
  additions: 234
  deletions: 13
  al: 3
apps:
  - Subscription Billing
objects_touched:
  - key: codeunit/8069
    page: codeunit/8069
    type: codeunit
    id: 8069
    name: Sales Subscription Line Mgmt.
    app: Subscription Billing
    status: modified
  - key: tableextension/8053
    page: tableextension/8053
    type: tableextension
    id: 8053
    name: Sales Header
    app: Subscription Billing
    status: modified
  - key: tableextension/8054
    page: tableextension/8054
    type: tableextension
    id: 8054
    name: Sales Line
    app: Subscription Billing
    status: modified
objects_unjoined: []
obsoletions: []
backports:
  - number: 12287
    base: releases/29.x
    url: https://github.com/microsoft/BCApps/pull/12287
fixes_issues:
  - 10175
work_items:
  - 651549
systems:
  - development
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #10210 [Bug][Subscription Billing] "Delete Invoiced Sales Orders" leaves orphaned Sales Subscription Lines behind

> Fixed orphaned Sales Subscription Lines left behind by "Delete Invoiced Sales Orders" and "Delete Invd Blnkt Sales Orders" reports by adding event subscribers and batch deletion procedures on the Sales Header table extension.

[Pull request](https://github.com/microsoft/BCApps/pull/10210) · merged into `main` (BC30) on 2026-10-02 by miljance (community contribution) · 4 files (+234 -13), 3 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Added two event subscribers in Sales Subscription Line Mgmt. so the Delete Invoiced Sales Orders and Delete Invd Blnkt Sales Orders reports also delete Sales Subscription Lines
- Report 299 cleanup hooks OnAfterDeleteSalesLinesLoop so lines are removed even when a Charge (Item) line keeps the order
- New public DeleteSalesServiceCommitments() on the Sales Header extension batch-deletes a document's subscription lines and is shared by both reports, Sales-Post and Sales-Quote to Order
- DeleteSalesServiceCommitment on Sales Line and the new header procedure are public with XML documentation for external callers
- Three new tests cover invoiced orders, blanket orders and posting
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 8069 "Sales Subscription Line Mgmt."](../../objects/codeunit/8069.md), Subscription Billing: modified
- [Table extension 8053 "Sales Header"](../../objects/tableextension/8053.md), Subscription Billing: modified
- [Table extension 8054 "Sales Line"](../../objects/tableextension/8054.md), Subscription Billing: modified

## Also merged into

- [#12287](https://github.com/microsoft/BCApps/pull/12287) into `releases/29.x` on 2026-10-06

## Context

- Fixes: [#10175 [Bug][Subscription Billing] "Delete Invoiced Sales Orders" leaves orphaned Sales Subscription Lines behind](https://github.com/microsoft/BCApps/issues/10175) (closed)
- Work items: AB#651549
- Labels: ADO: Sync, AL: Apps (W1), From Fork, Team: Finance
- Systems: development

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