---
id: change/bcapps/10051
type: change
title: "#10051 Bug 642053: [master] [Sustainability] Preview Posting Creates Gaps in Sustainability Ledger Entry Numbers"
summary: Preview posting of journal lines and documents that carry sustainability emissions no longer leaves gaps in Sustainability Ledger Entry numbers. Preview rows are now collected in memory under temporary numbers instead of being inserted, so no AutoIncrement identity is used. Normal posting is unchanged.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit sust. preview post instance
  - codeunit sust. preview posting handler
  - codeunit sustainability post mgt
system: sustainability
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:08:14.095Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 8461e7f56d15586dd57a0c0bbd34e97cbff05e9e
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10051
    title: "microsoft/BCApps#10051: Bug 642053: [master] [Sustainability] Preview Posting Creates Gaps in Sustainability Ledger Entry Numbers"
    date: "2026-08-19"
    commit: 8461e7f56d15586dd57a0c0bbd34e97cbff05e9e
    t: null
    quote: Preview no longer inserts real Sustainability Ledger Entries.
links:
  learn: []
  objects:
    - object/codeunit/6233
    - object/codeunit/6228
    - object/codeunit/6212
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10051
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10051
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-19T10:31:25Z"
author: AleksanderGladkov
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: 7
  additions: 639
  deletions: 6
  al: 3
apps:
  - Sustainability
objects_touched:
  - key: codeunit/6233
    page: codeunit/6233
    type: codeunit
    id: 6233
    name: Sust. Preview Post Instance
    app: Sustainability
    status: modified
  - key: codeunit/6228
    page: codeunit/6228
    type: codeunit
    id: 6228
    name: Sust. Preview Posting Handler
    app: Sustainability
    status: modified
  - key: codeunit/6212
    page: codeunit/6212
    type: codeunit
    id: 6212
    name: Sustainability Post Mgt
    app: Sustainability
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 642053
systems:
  - sustainability
  - development
quote: Preview no longer inserts real Sustainability Ledger Entries.
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #10051 Bug 642053: [master] [Sustainability] Preview Posting Creates Gaps in Sustainability Ledger Entry Numbers

> Preview posting of journal lines and documents that carry sustainability emissions no longer leaves gaps in Sustainability Ledger Entry numbers. Preview rows are now collected in memory under temporary numbers instead of being inserted, so no AutoIncrement identity is used. Normal posting is unchanged.

[Pull request](https://github.com/microsoft/BCApps/pull/10051) · merged into `main` (BC30) on 2026-08-19 by AleksanderGladkov · 7 files (+639 -6), 3 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Preview posting collects sustainability ledger entries in memory instead of physically inserting them to avoid consuming AutoIncrement identity numbers
- Adds interception logic to shared insert operation to redirect preview rows to temporary storage
- Normal posting behavior remains unchanged and maintains sequential numbering
- Comprehensive regression tests verify entry number continuity across journal types including general journal, purchase credit memo, recurring journals, and fixed asset journals
- Multiple preview operations no longer burn entry numbers
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 6233 "Sust. Preview Post Instance"](../../objects/codeunit/6233.md), Sustainability: modified
- [Codeunit 6228 "Sust. Preview Posting Handler"](../../objects/codeunit/6228.md), Sustainability: modified
- [Codeunit 6212 "Sustainability Post Mgt"](../../objects/codeunit/6212.md), Sustainability: modified

## Context

- Work items: AB#642053
- Labels: AL: Apps (W1), Team: Finance
- Systems: sustainability, development
- From the description: "Preview no longer inserts real Sustainability Ledger Entries."

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