---
id: change/bcapps/11262
type: change
title: "#11262 Fix retention policy deletion-limit stop propagation"
summary: The retention policy deletion limit now stops further policy processing correctly by propagating the stop flag through the temporary setup record after each policy runs, preventing additional limit events after the batch should have ended.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit apply retention policy impl.
  - table retention policy setup
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:04:09.054Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: c378eef150ab1c48e1959f56184e0f8150c76f74
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/11262
    title: "microsoft/BCApps#11262: Fix retention policy deletion-limit stop propagation"
    date: "2026-09-23"
    commit: c378eef150ab1c48e1959f56184e0f8150c76f74
    t: null
    quote: Return the stop flag through the temporary retention policy setup record alongside the deletion count
links:
  learn: []
  objects:
    - object/codeunit/3904
    - object/table/3901
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 11262
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/11262
kind: pr
base_branch: main
major: "30"
merged_at: "2026-09-23T09:40:00Z"
author: darjoo
author_type: User
community_contribution: false
labels:
  - "AL: System Application"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 105
  deletions: 0
  al: 2
apps:
  - System Application
objects_touched:
  - key: codeunit/3904
    page: codeunit/3904
    type: codeunit
    id: 3904
    name: Apply Retention Policy Impl.
    app: System Application
    status: modified
  - key: table/3901
    page: table/3901
    type: table
    id: 3901
    name: Retention Policy Setup
    app: System Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 649569
systems:
  - development
quote: Return the stop flag through the temporary retention policy setup record alongside the deletion count
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #11262 Fix retention policy deletion-limit stop propagation

> The retention policy deletion limit now stops further policy processing correctly by propagating the stop flag through the temporary setup record after each policy runs, preventing additional limit events after the batch should have ended.

[Pull request](https://github.com/microsoft/BCApps/pull/11262) · merged into `main` (BC30) on 2026-09-23 by darjoo · 3 files (+105 -0), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- The `EndCurrentRun` flag is now transported through the temporary retention policy setup record instead of being lost during isolated codeunit execution
- The outer loop can now check the stop condition after each policy completes instead of continuing blindly
- Per-policy error isolation is preserved while allowing proper batch termination
- Added regression test cases covering limit boundary conditions and multiple runs
- No changes to event signatures, scheduling, or the deletion allowance configuration
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 3904 "Apply Retention Policy Impl."](../../objects/codeunit/3904.md), System Application: modified
- [Table 3901 "Retention Policy Setup"](../../objects/table/3901.md), System Application: modified

## Context

- Work items: AB#649569
- Labels: AL: System Application, Team: Integrations
- Systems: development
- From the description: "Return the stop flag through the temporary retention policy setup record alongside the deletion count"

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