---
id: change/bcapps/10867
type: change
title: '#10867 [29.x][ALL-E]Issues with Service Contract Invoicing and Retrospective Billing--when the second unposted Service Invoice is deleted the values on the Service Contract are no longer reset--The "Invoiced to Date" field does not resetInitial commit- #10345Initial commit'
summary: Fixed Service Contract invoicing to properly reset the "Invoiced to Date" field when unposted Service Invoices are deleted, even when multiple invoices have been processed.
tier: official
language: en
tags:
  - fix
  - releases/29.x
  - bc29
  - table service header
  - table service ledger entry
system: service
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:06:34.703Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: b0558f3dd55c092799799078c4bcb3827a1fbbf7
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10867
    title: 'microsoft/BCApps#10867: [29.x][ALL-E]Issues with Service Contract Invoicing and Retrospective Billing--when the second unposted Service Invoice is deleted the values on the Service Contract are no longer reset--The "Invoiced to Date" field does not resetInitial commit- #10345Initial commit'
    date: "2026-09-03"
    commit: b0558f3dd55c092799799078c4bcb3827a1fbbf7
    t: null
    quote: when the second unposted Service Invoice is deleted the values on the Service Contract are no longer reset
links:
  learn: []
  objects:
    - object/table/5900
    - object/table/5907
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10867
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10867
kind: pr
base_branch: releases/29.x
major: "29"
merged_at: "2026-09-03T08:10:41Z"
author: sanjmaurya
author_type: User
community_contribution: false
labels:
  - "Team: SCM"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 135
  deletions: 11
  al: 2
apps:
  - Base Application
objects_touched:
  - key: table/5900
    page: table/5900
    type: table
    id: 5900
    name: Service Header
    app: Base Application
    status: modified
  - key: table/5907
    page: table/5907
    type: table
    id: 5907
    name: Service Ledger Entry
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 648515
systems:
  - service
quote: when the second unposted Service Invoice is deleted the values on the Service Contract are no longer reset
joined_against:
  major: "29"
  commit: 1d24dd5ee2a734510f0556ccc69342d0e616db2f
---

# #10867 [29.x][ALL-E]Issues with Service Contract Invoicing and Retrospective Billing--when the second unposted Service Invoice is deleted the values on the Service Contract are no longer reset--The "Invoiced to Date" field does not resetInitial commit- #10345Initial commit

> Fixed Service Contract invoicing to properly reset the "Invoiced to Date" field when unposted Service Invoices are deleted, even when multiple invoices have been processed.

[Pull request](https://github.com/microsoft/BCApps/pull/10867) · merged into `releases/29.x` (BC29) on 2026-09-03 by sanjmaurya · 3 files (+135 -11), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- The "Invoiced to Date" field was stuck at its previous value after deleting the second unposted invoice, blocking new invoices from being created
- Reversed ledger entries left behind by deleted invoices were incorrectly counted as existing entries
- The fix filters out reversed entries by checking for original entries without corresponding reversals
- Contract lines with only reversed invoicing history now correctly reset "Invoiced to Date" to zero
- Behaviour changes for users or extensions.

## AL objects touched

- [Table 5900 "Service Header"](../../objects/table/5900.md), Base Application: modified
- [Table 5907 "Service Ledger Entry"](../../objects/table/5907.md), Base Application: modified

## Context

- Work items: AB#648515
- Labels: Team: SCM
- Systems: service
- From the description: "when the second unposted Service Invoice is deleted the values on the Service Contract are no longer reset"

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