---
id: change/bcapps/14329
type: change
title: "#14329 Optimizing check for PA eligibility"
summary: The Payables Agent eligibility check now uses a more efficient query strategy to avoid unnecessary slowdowns when opening the Purchase Invoice page by leveraging an existing database index on Posting Date instead of relying on systemCreatedAt.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - codeunit pa agent access
  - query pa recent purch. inv. creators
system: copilot
review:
  state: reviewed
  by: opus
  at: "2026-11-22T00:57:45.824Z"
  flags: []
generated:
  at: "2026-12-05T00:13:03.967Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 651fa482a8eda31b59fd2ace52bebe27330c5f0d
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/14329
    title: "microsoft/BCApps#14329: Optimizing check for PA eligibility"
    date: "2026-11-21"
    commit: 651fa482a8eda31b59fd2ace52bebe27330c5f0d
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/3350
    - object/query/3304
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/optimize-sql-query-objects-and-performance
      title: Query Objects and Performance
      label: possibly related
      why: Explains query objects and performance optimization with indexes and SIFT
      by: model
number: 14329
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/14329
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-21T16:55:48Z"
author: mynjj
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Finance"
change_class: code
change_kind: performance
behavior_change: true
breaking: false
files:
  count: 2
  additions: 39
  deletions: 5
  al: 2
apps:
  - PayablesAgent
objects_touched:
  - key: codeunit/3350
    page: codeunit/3350
    type: codeunit
    id: 3350
    name: PA Agent Access
    app: PayablesAgent
    status: modified
  - key: query/3304
    page: query/3304
    type: query
    id: 3304
    name: PA Recent Purch. Inv. Creators
    app: PayablesAgent
    status: added
objects_unjoined: []
obsoletions: []
backports:
  - number: 14355
    base: releases/29.x
    url: https://github.com/microsoft/BCApps/pull/14355
fixes_issues: []
work_items:
  - 652918
systems:
  - copilot
quote: null
joined_against:
  major: "30"
  commit: 4d60d10920084a35a6231e5a0ffbd0577b0c399e
---

# #14329 Optimizing check for PA eligibility

> The Payables Agent eligibility check now uses a more efficient query strategy to avoid unnecessary slowdowns when opening the Purchase Invoice page by leveraging an existing database index on Posting Date instead of relying on systemCreatedAt.

[Pull request](https://github.com/microsoft/BCApps/pull/14329) · merged into `main` (BC30) on 2026-11-21 by mynjj · 2 files (+39 -5), 2 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- A new query checks Payables Agent eligibility using Posting Date instead of systemCreatedAt
- Uses the existing BaseApp key on Posting Date, then iterates the results to match the user ID
- Limits how many records are loaded from SQL so the check stays time-bounded
- Speeds up opening the Purchase Invoice page and the agent runtime eligibility check
- The heuristic is less accurate, so the set of eligible users may differ slightly
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 3350 "PA Agent Access"](../../objects/codeunit/3350.md), PayablesAgent: modified
- [Query 3304 "PA Recent Purch. Inv. Creators"](../../objects/query/3304.md), PayablesAgent: added

## Also merged into

- [#14355](https://github.com/microsoft/BCApps/pull/14355) into `releases/29.x` on 2026-11-25

## Context

- Work items: AB#652918
- Labels: AL: Apps (W1), Team: Finance
- Systems: copilot

## Possibly related

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

- [Query Objects and Performance](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/optimize-sql-query-objects-and-performance) — possibly related: Explains query objects and performance optimization with indexes and SIFT (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).
