---
id: object/codeunit/4324
type: object
title: Codeunit 4324 "Agent Setup"
summary: Codeunit 4324 "Agent Setup" in System Application (System.Agents). 14 public procedures. Introduced in BC27, still in BC30, changed in BC28.
tier: official
language: en
tags:
  - codeunit
  - system application
versions:
  introduced: "27"
  last_changed: "28"
  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: 92754d5d215164bb9ce23e7ba439a51fdd3fdf4caf0433e4807ad53ede457fce
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Agent/Setup/SetupPart/AgentSetup.Codeunit.al
    title: src/System Application/App/Agent/Setup/SetupPart/AgentSetup.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 4324
name: Agent Setup
namespace: System.Agents
app: System Application
extends: null
first_version: "27"
last_version: "30"
present_in:
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 14
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 1
  called_by: 11
  implements: 0
---

# Codeunit 4324 "Agent Setup"

> Codeunit 4324 "Agent Setup" in System Application (System.Agents). 14 public procedures. Introduced in BC27, still in BC30, changed in BC28.

System Application · System.Agents · BC27-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/System%20Application/App/Agent/Setup/SetupPart/AgentSetup.Codeunit.al) · facts from BC29

## Procedures

- `GetSetupRecord(var AgentSetupBuffer: Record "Agent Setup Buffer"; UserSecurityID: Guid; AgentMetadataProvider: Enum "Agent Metadata Provider"; DefaultUserName: Code[50]; DefaultDisplayName: Text[80]; AgentSummary: Text)`: Gets the setup record for existing agents or initializes a new setup record for new agents.
- `CopySetupRecord(var Target: Record "Agent Setup Buffer"; var Source: Record "Agent Setup Buffer")`: Copies the setup record from the source buffer to the target buffer.
- `SaveChanges(var AgentSetupBuffer: Record "Agent Setup Buffer"): Guid`: Saves changes done. If the agent does not exist we will create a new agent otherwise we will update the agent.
- `GetChangesMade(var AgentSetupBuffer: Record "Agent Setup Buffer"): Boolean`: Checks if there are any changes made in the setup buffer that need to be saved.
- `OpenLanguageAndRegionPage(var AgentSetupBuffer: Record "Agent Setup Buffer"): Boolean`: Opens a page where the language and region settings for the agent can be updated.
- `GetAgentSummary(var AgentSetupBuffer: Record "Agent Setup Buffer"): Text`: Retrieves the summary information about the agent.
- `OpenAgentAccessControlPage(var AgentSetupBuffer: Record "Agent Setup Buffer"): Boolean`: Opens a page where the user access control settings for the agent can be updated.
- `OpenProfileLookup(var UserSettingsRec: Record "User Settings"): Boolean`: Allows the user to select a profile out of the list of available profiles. The user settings record will be updated with the selected profile.
- `OpenAgentLookup(var AgentUserSecurityId: Guid): Boolean`: Allows the user to select an agent out of the list of enabled agents.
- `FindAgentByUserName(AgentUserName: Text; var AgentUserSecurityId: Guid): Boolean`: Finds the agent user security ID based on the provided user name.
- `OpenAgentLookup(AgentType: Enum "Agent Metadata Provider"; var AgentUserSecurityId: Guid): Boolean`: Allows the user to select an agent out of the list of enabled agents.
- `OpenSetupPage(var AgentSetupBuffer: Record "Agent Setup Buffer")`: Opens the setup page for the agent.
- `OpenSetupPage(AgentUserSecurityId: Guid)`: Opens the setup page for the agent.
- `UpdateUserAccessControl(var AgentSetupBuffer: Record "Agent Setup Buffer"): Boolean`: Opens the page where the user access control settings for the agent can be updated.

## 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 4325 "Agent Setup Impl."](../codeunit/4325.md) (12 calls: `CopySetupRecord → CopySetupRecord`, `FindAgentByUserName → FindAgentByUserName`, `GetAgentSummary → GetAgentSummary`, …)

## Called by

- [Codeunit 4400 "SOA Setup"](../codeunit/4400.md) (4 calls: `CreateAgent → SaveChanges`, `CreateDefaultAgentNoEmail → GetSetupRecord`, `CreateDefaultAgentNoEmail → SaveChanges`, …)
- [Codeunit 3307 "Payables Agent Setup"](../codeunit/3307.md) (2 calls: `ApplyAgentSetup → SaveChanges`, `LoadSetupConfiguration → GetSetupRecord`)
- [Page 3304 "Payables Agent Setup"](../page/3304.md) (2 calls: `OnAfterGetCurrRecord → GetChangesMade`, `OnQueryClosePage → GetChangesMade`)
- [Page 4310 "Agent Setup Part"](../page/4310.md) (2 calls: `GetChangesMade → GetChangesMade`, `Initialize → GetSetupRecord`)
- [Page 6991 "Expense Agent Setup Wizard"](../page/6991.md) (2 calls: `OnAfterGetCurrRecord → GetChangesMade`, `PersistAgentState → SaveChanges`)
- [Codeunit 3304 "PA Setup Configuration"](../codeunit/3304.md) (1 call: `SetAgentSetupBuffer → CopySetupRecord`)
- [Codeunit 4350 "Custom Agent Setup"](../codeunit/4350.md) (1 call: `UpdateAgent → SaveChanges`)
- [Page 4350 "Custom Agent Setup"](../page/4350.md) (1 call: `UpdateControls → GetSetupRecord`)
- [Page 4400 "SOA Setup"](../page/4400.md) (1 call: `OnAfterGetCurrRecord → GetChangesMade`)
- [Page extension 4351 "Agent Task List"](../pageextension/4351.md) (1 call: `GetAgentSecurityID → OpenAgentLookup`)
- [Table 6930 "Expense Agent Setup"](../table/6930.md) (1 call: `GetAgentConfiguredByName → GetSetupRecord`)

## Across versions

- Present in: BC27-30
- Changed (declaration) in: BC28

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