---
id: change/bcquality/161
type: change
title: "#161 AL methods limited during write transactions (RunModal, Codeunit.Run)"
summary: New performance guidance documents platform restrictions on calling RunModal and Codeunit.Run methods during write transactions, explaining when each method is blocked and how to structure code to avoid triggering the runtime error.
tier: official
language: en
tags:
  - feature
  - main
system: platform
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:03:52.830Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 56ce52a9c7a01046d4f2b603ddb0d9d044bb9502
evidence:
  - kind: code
    url: https://github.com/microsoft/BCQuality/pull/161
    title: "microsoft/BCQuality#161: AL methods limited during write transactions (RunModal, Codeunit.Run)"
    date: "2026-09-29"
    commit: 56ce52a9c7a01046d4f2b603ddb0d9d044bb9502
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 161
repo: microsoft/BCQuality
source_id: bcquality-prs
url: https://github.com/microsoft/BCQuality/pull/161
kind: pr
base_branch: main
major: null
merged_at: "2026-09-29T15:13:36Z"
author: MichaelDieringer
author_type: User
community_contribution: false
labels: []
change_class: code
change_kind: feature
behavior_change: false
breaking: false
files:
  count: 5
  additions: 85
  deletions: 2
  al: 5
apps: []
objects_touched: []
objects_unjoined:
  - path: microsoft/knowledge/performance/al-methods-limited-during-write-transactions.bad.al
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/al-methods-limited-during-write-transactions.good.al
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/al-methods-limited-during-write-transactions.md
    status: added
    reason: not-in-snapshot
  - path: microsoft/knowledge/performance/avoid-user-prompts-inside-transactions.md
    status: modified
    reason: not-in-snapshot
  - path: microsoft/skills/review/al-performance-review.md
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items: []
systems:
  - platform
  - development
quote: null
joined_against:
  major: null
  commit: null
---

# #161 AL methods limited during write transactions (RunModal, Codeunit.Run)

> New performance guidance documents platform restrictions on calling RunModal and Codeunit.Run methods during write transactions, explaining when each method is blocked and how to structure code to avoid triggering the runtime error.

[Pull request](https://github.com/microsoft/BCQuality/pull/161) · merged into `main` on 2026-09-29 by MichaelDieringer · 5 files (+85 -2), 5 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- Page.RunModal is never allowed in a write transaction; Report and XmlPort.RunModal only when the request page is suppressed
- Codeunit.Run is allowed only when its return value is unused
- 'Modal page' removed from the user-prompts article because that case fails with a runtime error rather than stalling
- Recommended structure follows Base Application's Commit() before Page.RunModal pattern
- Performance review skill gains RunModal and UseRequestPage cues and routes Codeunit.Run to its existing article

## AL objects touched

- `microsoft/knowledge/performance/al-methods-limited-during-write-transactions.bad.al`: added, not in the BC? snapshot yet
- `microsoft/knowledge/performance/al-methods-limited-during-write-transactions.good.al`: added, not in the BC? snapshot yet
- `microsoft/knowledge/performance/al-methods-limited-during-write-transactions.md`: added, not in the BC? snapshot yet
- `microsoft/knowledge/performance/avoid-user-prompts-inside-transactions.md`: modified, not in the BC? snapshot
- `microsoft/skills/review/al-performance-review.md`: modified, not in the BC? snapshot

## Context

- Systems: platform, development

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