---
id: change/bcapps/13499
type: change
title: "#13499 [Expense Agent] Defer per-diem policy invalidation until the parent line is saved"
summary: Per-diem policy invalidation on expense report lines is deferred until the parent record saves, preventing stale parent buffers when child records are added during bulk generation. Policy state changes are now coalesced into a single version increment rather than multiple invalidations.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - table expense report line
  - table expense report line per diem
  - codeunit expense auto population
system: copilot
review:
  state: reviewed
  by: opus
  at: "2026-11-11T00:57:29.606Z"
  flags: []
generated:
  at: "2026-11-29T00:16:19.301Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: d63214dc2c84c211518c23d600ae877afd6d940c
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/13499
    title: "microsoft/BCApps#13499: [Expense Agent] Defer per-diem policy invalidation until the parent line is saved"
    date: "2026-11-10"
    commit: d63214dc2c84c211518c23d600ae877afd6d940c
    t: null
    quote: Suppress parent invalidation only on the local child-record instance used by bulk generation; retain the child insert trigger and its existing validations.
links:
  learn: []
  objects:
    - object/table/6907
    - object/table/6909
    - object/codeunit/6912
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/expense-management/expense-management-per-diem-mileage
      title: Set Up Per Diem and Mileage Allowances
      label: possibly related
      why: Documents per diem allowance setup and configuration for expense management.
      by: model
number: 13499
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/13499
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-10T16:03:54Z"
author: encimita
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: 4
  additions: 561
  deletions: 12
  al: 3
apps:
  - ExpenseAgent
objects_touched:
  - key: table/6907
    page: table/6907
    type: table
    id: 6907
    name: Expense Report Line
    app: ExpenseAgent
    status: modified
  - key: table/6909
    page: table/6909
    type: table
    id: 6909
    name: Expense Report Line Per Diem
    app: ExpenseAgent
    status: modified
  - key: codeunit/6912
    page: codeunit/6912
    type: codeunit
    id: 6912
    name: Expense Auto Population
    app: ExpenseAgent
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 648711
systems:
  - copilot
quote: Suppress parent invalidation only on the local child-record instance used by bulk generation; retain the child insert trigger and its existing validations.
joined_against:
  major: "30"
  commit: d2abc1d2ceae394331716c8183ef60e1534c2ce0
---

# #13499 [Expense Agent] Defer per-diem policy invalidation until the parent line is saved

> Per-diem policy invalidation on expense report lines is deferred until the parent record saves, preventing stale parent buffers when child records are added during bulk generation. Policy state changes are now coalesced into a single version increment rather than multiple invalidations.

[Pull request](https://github.com/microsoft/BCApps/pull/13499) · merged into `main` (BC30) on 2026-11-10 by encimita · 4 files (+561 -12), 3 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Child-record insert/modify/delete triggers retain normal policy invalidation for direct API calls
- Parent invalidation is suppressed only for local child instances used by bulk generation
- Pending child-detail changes are marked on the parent buffer and consumed during parent save
- Policy evaluation confirmation is rejected if pending child changes haven't been saved yet
- Four new tests cover location-triggered generation, child-only regeneration, date-range extension, and pending change validation
- Behaviour changes for users or extensions.

## AL objects touched

- [Table 6907 "Expense Report Line"](../../objects/table/6907.md), ExpenseAgent: modified
- [Table 6909 "Expense Report Line Per Diem"](../../objects/table/6909.md), ExpenseAgent: modified
- [Codeunit 6912 "Expense Auto Population"](../../objects/codeunit/6912.md), ExpenseAgent: modified

## Context

- Work items: AB#648711
- Labels: AL: Apps (W1), Team: Finance
- Systems: copilot
- From the description: "Suppress parent invalidation only on the local child-record instance used by bulk generation; retain the child insert trigger and its existing validations."

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Set Up Per Diem and Mileage Allowances](https://learn.microsoft.com/dynamics365/business-central/expense-management/expense-management-per-diem-mileage) — possibly related: Documents per diem allowance setup and configuration for expense management. (model-linked)

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