---
id: change/bcapps/7546
type: change
title: "#7546 [Payables Agent] Agent-driven line matching"
summary: Adds agent-driven line matching to the Payables Agent, allowing agents to resolve purchase lines by navigating BC pages instead of using the AL PrepareDraft pipeline when the PAAgentDrivenLineMatching feature flag is enabled.
tier: official
language: en
tags:
  - feature
  - main
  - bc30
  - permissionset e-doc. core - objects
  - codeunit prepare purchase e-doc. draft
  - page e-doc. purchase draft subform
  - codeunit e-doc. hist. line data loader
  - page e-doc. historical lines list
  - pagecustomization pa chart of accounts
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:08:36.806Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 7e34876a054339f0ad3439fea4dc9cff64df6171
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/7546
    title: "microsoft/BCApps#7546: [Payables Agent] Agent-driven line matching"
    date: "2026-08-18"
    commit: 7e34876a054339f0ad3439fea4dc9cff64df6171
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/permissionset/6100
    - object/codeunit/6125
    - object/page/6183
    - object/codeunit/6244
    - object/page/6186
    - object/pagecustomization/pa-chart-of-accounts
    - object/pagecustomization/pa-deferral-template-list
    - object/pagecustomization/pa-edoc-purchase-draft-subform
    - object/pagecustomization/pa-hist-purchase-lines
    - object/pagecustomization/pa-item-reference-entries
    - object/pagecustomization/pa-items
    - object/pagecustomization/pa-text-to-account-mapping
    - object/profile/payables-agent
    - object/codeunit/3307
    - object/table/3303
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 7546
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/7546
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-18T18:47:00Z"
author: dayland
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Ownership: Manual"
  - "Team: Finance"
change_class: code
change_kind: feature
behavior_change: true
breaking: false
files:
  count: 17
  additions: 1249
  deletions: 6
  al: 15
apps:
  - EDocument
  - PayablesAgent
objects_touched:
  - key: permissionset/6100
    page: permissionset/6100
    type: permissionset
    id: 6100
    name: E-Doc. Core - Objects
    app: EDocument
    status: modified
  - key: codeunit/6125
    page: codeunit/6125
    type: codeunit
    id: 6125
    name: Prepare Purchase E-Doc. Draft
    app: EDocument
    status: modified
  - key: page/6183
    page: page/6183
    type: page
    id: 6183
    name: E-Doc. Purchase Draft Subform
    app: EDocument
    status: modified
  - key: codeunit/6244
    page: codeunit/6244
    type: codeunit
    id: 6244
    name: E-Doc. Hist. Line Data Loader
    app: EDocument
    status: added
  - key: page/6186
    page: page/6186
    type: page
    id: 6186
    name: E-Doc. Historical Lines List
    app: EDocument
    status: added
  - key: pagecustomization/pa chart of accounts
    page: pagecustomization/pa-chart-of-accounts
    type: pagecustomization
    id: null
    name: PA Chart of Accounts
    app: PayablesAgent
    status: added
  - key: pagecustomization/pa deferral template list
    page: pagecustomization/pa-deferral-template-list
    type: pagecustomization
    id: null
    name: PA Deferral Template List
    app: PayablesAgent
    status: added
  - key: pagecustomization/pa edoc purchase draft subform
    page: pagecustomization/pa-edoc-purchase-draft-subform
    type: pagecustomization
    id: null
    name: PA EDoc Purchase Draft Subform
    app: PayablesAgent
    status: modified
  - key: pagecustomization/pa hist. purchase lines
    page: pagecustomization/pa-hist-purchase-lines
    type: pagecustomization
    id: null
    name: PA Hist. Purchase Lines
    app: PayablesAgent
    status: added
  - key: pagecustomization/pa item reference entries
    page: pagecustomization/pa-item-reference-entries
    type: pagecustomization
    id: null
    name: PA Item Reference Entries
    app: PayablesAgent
    status: added
  - key: pagecustomization/pa items
    page: pagecustomization/pa-items
    type: pagecustomization
    id: null
    name: PA Items
    app: PayablesAgent
    status: added
  - key: pagecustomization/pa text-to-account mapping
    page: pagecustomization/pa-text-to-account-mapping
    type: pagecustomization
    id: null
    name: PA Text-to-Account Mapping
    app: PayablesAgent
    status: added
  - key: profile/payables agent
    page: profile/payables-agent
    type: profile
    id: null
    name: Payables Agent
    app: PayablesAgent
    status: modified
  - key: codeunit/3307
    page: codeunit/3307
    type: codeunit
    id: 3307
    name: Payables Agent Setup
    app: PayablesAgent
    status: modified
  - key: table/3303
    page: table/3303
    type: table
    id: 3303
    name: Payables Agent Setup
    app: PayablesAgent
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 607916
systems:
  - development
  - integration
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #7546 [Payables Agent] Agent-driven line matching

> Adds agent-driven line matching to the Payables Agent, allowing agents to resolve purchase lines by navigating BC pages instead of using the AL PrepareDraft pipeline when the PAAgentDrivenLineMatching feature flag is enabled.

[Pull request](https://github.com/microsoft/BCApps/pull/7546) · merged into `main` (BC30) on 2026-08-18 by dayland · 17 files (+1249 -6), 15 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- Feature flag PAAgentDrivenLineMatching gates all new behavior, leaving default behavior unchanged
- New historical line data loader retrieves up to 5000 posted purchase invoice lines from the last year, prioritized by vendor and relevance
- Five new flag-gated lookup actions on draft purchase lines: Text-to-Account Mappings, Historical Purchase Lines, Chart of Accounts, Items, and Deferral Templates
- New agent-driven instructions prompt implements a collect-then-synthesize matching strategy across six data sources
- Six new read-only page customizations registered in the Payables Agent profile for agent navigation
- Behaviour changes for users or extensions.

## AL objects touched

- [Permission set 6100 "E-Doc. Core - Objects"](../../objects/permissionset/6100.md), EDocument: modified
- [Codeunit 6125 "Prepare Purchase E-Doc. Draft"](../../objects/codeunit/6125.md), EDocument: modified
- [Page 6183 "E-Doc. Purchase Draft Subform"](../../objects/page/6183.md), EDocument: modified
- [Codeunit 6244 "E-Doc. Hist. Line Data Loader"](../../objects/codeunit/6244.md), EDocument: added
- [Page 6186 "E-Doc. Historical Lines List"](../../objects/page/6186.md), EDocument: added
- [pagecustomization "PA Chart of Accounts"](../../objects/pagecustomization/pa-chart-of-accounts.md), PayablesAgent: added
- [pagecustomization "PA Deferral Template List"](../../objects/pagecustomization/pa-deferral-template-list.md), PayablesAgent: added
- [pagecustomization "PA EDoc Purchase Draft Subform"](../../objects/pagecustomization/pa-edoc-purchase-draft-subform.md), PayablesAgent: modified
- [pagecustomization "PA Hist. Purchase Lines"](../../objects/pagecustomization/pa-hist-purchase-lines.md), PayablesAgent: added
- [pagecustomization "PA Item Reference Entries"](../../objects/pagecustomization/pa-item-reference-entries.md), PayablesAgent: added
- [pagecustomization "PA Items"](../../objects/pagecustomization/pa-items.md), PayablesAgent: added
- [pagecustomization "PA Text-to-Account Mapping"](../../objects/pagecustomization/pa-text-to-account-mapping.md), PayablesAgent: added
- [Profile "Payables Agent"](../../objects/profile/payables-agent.md), PayablesAgent: modified
- [Codeunit 3307 "Payables Agent Setup"](../../objects/codeunit/3307.md), PayablesAgent: modified
- [Table 3303 "Payables Agent Setup"](../../objects/table/3303.md), PayablesAgent: modified

## Context

- Work items: AB#607916
- Labels: AL: Apps (W1), Ownership: Manual, Team: Finance
- Systems: development, integration

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