---
id: change/bcapps/9950
type: change
title: "#9950 [Master] - Bug 645038 Withholding Tax entries from a previous posting preview appear on unrelated documents (e.g. expense report)"
summary: Withholding Tax entries from a previous posting preview no longer leak into unrelated document previews. The fix clears temporary WHT entries at the start of each preview instead of only during actual posting.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit wthldg tax preview handler
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:09:41.397Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 749fad5d164842936c2a9a975d3672977f17cc05
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9950
    title: "microsoft/BCApps#9950: [Master] - Bug 645038 Withholding Tax entries from a previous posting preview appear on unrelated documents (e.g. expense report)"
    date: "2026-08-11"
    commit: 749fad5d164842936c2a9a975d3672977f17cc05
    t: null
    quote: temporary Withholding Tax entries were only cleared from subscribers tied to actual posting
links:
  learn: []
  objects:
    - object/codeunit/6792
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9950
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9950
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-11T08:49:09Z"
author: v-rohangarg20
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 1
  additions: 2
  deletions: 18
  al: 1
apps:
  - WithholdingTax
objects_touched:
  - key: codeunit/6792
    page: codeunit/6792
    type: codeunit
    id: 6792
    name: Wthldg Tax Preview Handler
    app: WithholdingTax
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 645038
systems:
  - development
quote: temporary Withholding Tax entries were only cleared from subscribers tied to actual posting
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9950 [Master] - Bug 645038 Withholding Tax entries from a previous posting preview appear on unrelated documents (e.g. expense report)

> Withholding Tax entries from a previous posting preview no longer leak into unrelated document previews. The fix clears temporary WHT entries at the start of each preview instead of only during actual posting.

[Pull request](https://github.com/microsoft/BCApps/pull/9950) · merged into `main` (BC30) on 2026-08-11 by v-rohangarg20 · 1 file (+2 -18), 1 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Fixed bug where stale Withholding Tax entries from one preview appeared when previewing an unrelated document
- Root cause was that temporary entries were only cleared on actual posting, not on preview operations
- Solution clears the temporary Withholding Tax buffer at the start of every preview operation
- Removed subscribers from OnBeforePostPurchaseDoc and OnBeforeGenJnlDoc events
- Cleaned up unused imports after refactoring
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 6792 "Wthldg Tax Preview Handler"](../../objects/codeunit/6792.md), WithholdingTax: modified

## Context

- Work items: AB#645038
- Labels: AL: Apps (W1), Team: Finance
- Systems: development
- From the description: "temporary Withholding Tax entries were only cleared from subscribers tied to actual posting"

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