---
id: object/codeunit/3303
type: object
title: Codeunit 3303 "Payables Agent"
summary: Codeunit 3303 "Payables Agent" in PayablesAgent (Microsoft.Agent.PayablesAgent). 19 public procedures, 4 event subscribers. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - payablesagent
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 17bdebd9c9bfddeb58f4076061ffcc6cc76df9158948849e0707fd74100c289b
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/PayablesAgent/app/PayablesAgent.Codeunit.al
    title: src/Apps/W1/PayablesAgent/app/PayablesAgent.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9139
object_type: codeunit
object_id: 3303
name: Payables Agent
namespace: Microsoft.Agent.PayablesAgent
app: PayablesAgent
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 24
  events: 0
  subscribers: 4
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 11
  called_by: 8
  implements: 0
---

# Codeunit 3303 "Payables Agent"

> Codeunit 3303 "Payables Agent" in PayablesAgent (Microsoft.Agent.PayablesAgent). 19 public procedures, 4 event subscribers. Introduced in BC29, still in BC30.

PayablesAgent · Microsoft.Agent.PayablesAgent · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/PayablesAgent/app/PayablesAgent.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Internal |
| Subtype | Install |
| Permissions | tabledata "Payables Agent Setup" = R, tabledata User = R, tabledata Agent = R, tabledata "Agent Task Message" = R |

## Event subscriptions

- OnRegisterCopilotCapability subscribes to Page "Copilot AI Capabilities" OnRegisterCopilotCapability
- ClassifyDataSensitivity subscribes to Codeunit "Data Classification Eval. Data" OnCreateEvaluationDataOnAfterClassifyTablesToNormal
- CreateAgentTask subscribes to Codeunit "E-Doc. Import" OnAfterProcessIncomingEDocument
- OnOpenInboundEDocumentsPage subscribes to Page "Inbound E-Documents" OnOpenPageEvent

## Procedures

- `GetSetupPageId(AgentUserId: Guid): Integer`
- `GetSummaryPageId(AgentUserId: Guid): Integer`
- `GetAgentAnnotations(AgentUserId: Guid; var Annotations: Record "Agent Annotation")`
- `GetAgentTaskMessagePageId(AgentUserId: Guid; MessageId: Guid): Integer`
- `GetDefaultInitials(): Text[4]`
- `GetInitials(AgentUserId: Guid): Text[4]`
- `GetFirstTimeSetupPageId(): Integer`
- `ShowCanCreateAgent(): Boolean`
- `GetCopilotCapability(): Enum "Copilot Capability"`
- `GetCurrentSessionsEDocument(): Record "E-Document"`: If the current session is a payables agent session, this procedure will return the e-document being processed by the agent.
- `GetEDocumentForAgentTask(AgentTaskId: BigInteger): Record "E-Document"`: Given a payables agent task id, it returns the e-document associated with the task.
- `BuildAgentTask(EDocument: Record "E-Document"; Agent: Record Agent)`
- `SetAgentTaskTitle(AgentTaskID: BigInteger; InvoiceNo: Text[50]; VendorName: Text[100])` (internal)
- `RegisterCapability()` (internal)
- `GetCustomDimensions(): Dictionary of [Text, Text]`
- `PayablesAgentExistsAcrossAllCompanies(): Boolean` (internal): Checks whether a Payables Agent exists in any company in the current environment.
- `IsPayablesAgentSession(var SessionTaskID: BigInteger): Boolean`
- `GetDefaultProfile(var TempAllProfile: Record "All Profile" temporary)`
- `GetDefaultAccessControls(var TempAccessControlBuffer: Record "Access Control Buffer" temporary)`

Plus 1 local procedures.

## Triggers

OnInstallAppPerDatabase

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 3307 "Payables Agent Setup"](../codeunit/3307.md) (7 calls: `BuildAgentTask → ShouldRequestReview`, `CreateAgentTask → FeatureName`, `CreateAgentTask → GetAgent`, …)
- [Codeunit 3318 "PA Trial"](../codeunit/3318.md) (4 calls: `BuildAgentTask → GetTrialInvoiceCount`, `BuildAgentTask → GetTrialInvoiceLimit`, `BuildAgentTask → IncrementTrialInvoiceCount`, …)
- [Codeunit 7773 "Copilot Capability"](../codeunit/7773.md) (3 calls: `RegisterCapability → IsCapabilityRegistered`, `RegisterCapability → ModifyCapability`, `RegisterCapability → RegisterCapability`)
- [Codeunit 4312 "Agent Session"](../codeunit/4312.md) (2 calls: `IsPayablesAgentSession → GetCurrentSessionAgentTaskId`, `IsPayablesAgentSession → IsAgentSession`)
- [Codeunit 1751 "Data Classification Eval. Data"](../codeunit/1751.md) (1 call: `ClassifyDataSensitivity → SetTableFieldsToNormal`)
- [Codeunit 3306 "Payables Agent KPI"](../codeunit/3306.md) (1 call: `CreateAgentTask → InsertKPIEntry`)
- [Codeunit 3313 "PA Annotation"](../codeunit/3313.md) (1 call: `GetAgentAnnotations → GetAgentAnnotations`)
- [Codeunit 4315 "Agent Task Builder"](../codeunit/4315.md) (1 call: `BuildAgentTask → Initialize`)
- [Codeunit 4316 "Agent Task Message Builder"](../codeunit/4316.md) (1 call: `BuildAgentTask → Initialize`)
- [Codeunit 457 "Environment Information"](../codeunit/457.md) (1 call: `RegisterCapability → IsSaaSInfrastructure`)
- [Codeunit 8711 "Telemetry"](../codeunit/8711.md) (1 call: `CreateAgentTask → LogMessage`)

## Called by

- [Codeunit 3311 "PA Billing"](../codeunit/3311.md) (5 calls: `LogPATrackingRecord → GetCustomDimensions`, `LogPurchaseDocumentDraftCreated → GetCustomDimensions`, `LogPurchaseDocumentDraftLinesProcessed → GetCurrentSessionsEDocument`, …)
- [Codeunit 3316 "PA Events"](../codeunit/3316.md) (3 calls: `RecordKnownSenderOnAgentProcessingStep → IsPayablesAgentSession`, `TrackFinalizedEDocuments → IsPayablesAgentSession`, `UpdateAgentTaskTitleOnPurchaseDocumentDraftCreated → SetAgentTaskTitle`)
- [Codeunit 3305 "Payables Agent Upgrade"](../codeunit/3305.md) (2 calls: `RegisterCapability → RegisterCapability`, `RegisterTrial → PayablesAgentExistsAcrossAllCompanies`)
- [Codeunit 3318 "PA Trial"](../codeunit/3318.md) (2 calls: `ResetTrial → GetCustomDimensions`, `StartTrial → GetCustomDimensions`)
- [Page extension 3309 "PA Purchase Invoice List"](../pageextension/3309.md) (2 calls: `UploadInvoiceWithAgent → GetCustomDimensions`, `UploadInvoiceWithAgent → PayablesAgentExistsAcrossAllCompanies`)
- [Codeunit 3308 "PA Open Current E-Document"](../codeunit/3308.md) (1 call: `OnRun → GetCurrentSessionsEDocument`)
- [Codeunit 3315 "PA Session Events"](../codeunit/3315.md) (1 call: `RegisterSubscribersOnAfterLogin → IsPayablesAgentSession`)
- [Page 3304 "Payables Agent Setup"](../page/3304.md) (1 call: `ProcessTrialUploadIfPending → GetCustomDimensions`)

## Recent changes

- 2026-07-07 [#9139 Fix Payables Agent permission error opening E-Document](../../changes/bcapps/9139.md) (main, BC30, fix)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Payables Agent")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
