---
id: object/codeunit/3350
type: object
title: Codeunit 3350 "PA Agent Access"
summary: Codeunit 3350 "PA Agent Access" in PayablesAgent (Microsoft.Agent.PayablesAgent). 9 public procedures. Introduced in BC30.
tier: official
language: en
tags:
  - codeunit
  - payablesagent
versions:
  introduced: "30"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-12-01T01:00:51.425Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: db87ed0a817ba4bd3c65a377537aec4cbb9fdf0b829aa01aaadd8cc016c753ba
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/f53bb0f1ecd89fde9f133f9dcaf5bf43cf5f2671/src/Apps/W1/PayablesAgent/app/Shared/Security/PAAgentAccess.Codeunit.al
    title: src/Apps/W1/PayablesAgent/app/Shared/Security/PAAgentAccess.Codeunit.al (main)
    date: null
    commit: f53bb0f1ecd89fde9f133f9dcaf5bf43cf5f2671
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/14442
    - change/bcapps/14329
    - change/bcapps/13361
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/payables-agent-setup
      title: Set Up Payables Agent in Business Central
      label: possibly related
      why: Controls user access configuration for Payables Agent setup
      by: model
object_type: codeunit
object_id: 3350
name: PA Agent Access
namespace: Microsoft.Agent.PayablesAgent
app: PayablesAgent
extends: null
first_version: "30"
last_version: "30"
present_in:
  - "30"
changed_in: []
source_major: "30"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 9
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 4
  called_by: 11
  implements: 0
---

# Codeunit 3350 "PA Agent Access"

> Codeunit 3350 "PA Agent Access" in PayablesAgent (Microsoft.Agent.PayablesAgent). 9 public procedures. Introduced in BC30.

PayablesAgent · Microsoft.Agent.PayablesAgent · BC30 · [source at f53bb0f1](https://github.com/microsoft/BCApps/blob/f53bb0f1ecd89fde9f133f9dcaf5bf43cf5f2671/src/Apps/W1/PayablesAgent/app/Shared/Security/PAAgentAccess.Codeunit.al) · facts from BC30

## Properties

| Property | Value |
|---|---|
| Access | Internal |

## Procedures

- `TryGetRuntimeAgentTaskId(var AgentTaskId: BigInteger): Boolean` (internal)
- `TryGetAgentViewTaskId(var AgentTaskId: BigInteger): Boolean` (internal)
- `IsAgentView(): Boolean` (internal)
- `TryGetRuntimeTaskOwnership(AgentTask: Record "Agent Task"; var IsOwned: Boolean): Boolean` (internal)
- `CanShowAgentActions(): Boolean` (internal)
- `AllowCreateNewAgent(): Boolean` (internal)
- `HasUserCreatedPostedPurchInvoice(): Boolean` (internal)
- `GetUsersThatHaveCreatedPostedPurchInvoice(): List of [Guid]` (internal)
- `InsertAccessControlForEligibleUsers(AgentUserSecurityId: Guid)` (internal)

## Calls

From the extracted call graph of BC30 (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 4312 "Agent Session"](../codeunit/4312.md) (4 calls: `CanShowAgentActions → IsAgentSession`, `TryGetRuntimeAgentTaskId → GetCurrentSessionAgentTaskId`, `TryGetRuntimeAgentTaskId → IsAgentSession`, …)
- [Codeunit 3343 "PA Setup"](../codeunit/3343.md) (2 calls: `AllowCreateNewAgent → TryGetStoredAgent`, `CanShowAgentActions → TryGetStoredAgent`)
- [Codeunit 7773 "Copilot Capability"](../codeunit/7773.md) (2 calls: `AllowCreateNewAgent → IsCapabilityActive`, `CanShowAgentActions → IsCapabilityActive`)
- [Codeunit 4317 "Agent System Permissions"](../codeunit/4317.md) (1 call: `AllowCreateNewAgent → CurrentUserHasCanManageAllAgentsPermission`)

## Called by

- [Codeunit 3341 "PA Work Item"](../codeunit/3341.md) (2 calls: `LoadCurrentSession → TryGetRuntimeAgentTaskId`, `TryGetOwnedAgentTask → TryGetRuntimeTaskOwnership`)
- [Page 3333 "Payables Agent Work Items"](../page/3333.md) (2 calls: `OnOpenPage → CanShowAgentActions`, `OnOpenPage → IsAgentView`)
- [Codeunit 3306 "Payables Agent KPI"](../codeunit/3306.md) (1 call: `CountPurchaseInvoiceCreatedByAgent → TryGetRuntimeAgentTaskId`)
- [Codeunit 3308 "PA Open Current E-Document"](../codeunit/3308.md) (1 call: `CurrentDocumentNo → TryGetAgentViewTaskId`)
- [Codeunit 3312 "PA Draft Based Subscribers"](../codeunit/3312.md) (1 call: `RecordKnownSenderOnAgentProcessingStep → TryGetRuntimeAgentTaskId`)
- [Codeunit 3332 "PA Draft Based Work Item"](../codeunit/3332.md) (1 call: `LoadForAgentTask → TryGetRuntimeTaskOwnership`)
- [Codeunit 3334 "PA Billing Binding"](../codeunit/3334.md) (1 call: `RegisterSubscribersOnAfterLogin → TryGetRuntimeAgentTaskId`)
- [Codeunit 3342 "PA Work Item Collection"](../codeunit/3342.md) (1 call: `InitializeTaskCandidates → TryGetAgentViewTaskId`)
- [Codeunit 3344 "PA Setup Update"](../codeunit/3344.md) (1 call: `Update → InsertAccessControlForEligibleUsers`)
- [Codeunit 3352 "Payables Agent Metadata"](../codeunit/3352.md) (1 call: `ShowCanCreateAgent → AllowCreateNewAgent`)
- [Page extension 3309 "PA Purchase Invoice List"](../pageextension/3309.md) (1 call: `OnOpenPage → CanShowAgentActions`)

## Recent changes

- 2026-11-25 [#14442 Offer the Payables Agent again in a company recreated with the same name](../../changes/bcapps/14442.md) (main, BC30, fix)
- 2026-11-21 [#14329 Optimizing check for PA eligibility](../../changes/bcapps/14329.md) (main, BC30, performance)
- 2026-11-14 [#13361 Foundation for Payables Agent V2.0](../../changes/bcapps/13361.md) (main, BC30, refactor, added)

## Across versions

- Present in: BC30
- Changed (declaration) in: none

## Possibly related

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

- [Set Up Payables Agent in Business Central](https://learn.microsoft.com/dynamics365/business-central/payables-agent-setup) — possibly related: Controls user access configuration for Payables Agent setup (model-linked)

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 BC30 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: "PA Agent Access")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
