Codeunit 4321 "Agent"
System Application · System.Agents
Across versions
- BC23-24not present
- BC25added
- BC26unchanged
- BC2712 procedures added, 8 procedures changed
- BC284 procedures added
- BC293 procedures added
- BC30unchanged
Neighbourhood 24 connected objects and pages
System Application · System.Agents · BC25-30 · source at ea08af5e · facts from BC29
Procedures
Create(AgentMetadataProvider: Enum "Agent Metadata Provider"; var UserName: Code[50]; UserDisplayName: Text[80]; var TempAgentAccessControl: Record "Agent Access Control" temporary): GuidΔ BC27: Creates a new agent. The agent will be in the disabled state, with the users that can interact with the agent setup.Activate(AgentUserSecurityID: Guid)Δ BC27: Activates the agentDeactivate(AgentUserSecurityID: Guid)Δ BC27: Deactivates the agentArchive(AgentUserSecurityID: Guid)+ BC29: Archives the agent. Archiving removes the agent from active use and cannot be undone. The agent must be inactive (deactivated) before it can be archived.IsArchivingSupported(AgentUserSecurityID: Guid): Boolean+ BC29: Checks if the agent type supports archiving.IsArchived(AgentUserSecurityID: Guid): Boolean+ BC29: Checks if the agent is archived.GetDisplayName(AgentUserSecurityID: Guid): Text[80]Δ BC27: Get the display name of the agent.GetUserName(AgentUserSecurityID: Guid): Code[50]Δ BC27: Get the user name of the agent.SetDisplayName(AgentUserSecurityID: Guid; DisplayName: Text[80])Δ BC27: Sets the display name of the agent.GetModelId(AgentUserSecurityID: Guid): Code[30]+ BC28: Gets the model ID of the agent.GetModelName(AgentUserSecurityID: Guid): Text[70]+ BC28: Gets the model name of the agent.SetModelId(AgentUserSecurityID: Guid; ModelId: Code[30])+ BC28: Sets the model ID of the agent.SetModelIdToAuto(AgentUserSecurityID: Guid)+ BC28: Sets the agent model to auto mode, meaning the agent will use the default agent model.SetInstructions(AgentUserSecurityID: Guid; Instructions: SecretText)Δ BC27: Set the instructions which agent will use to complete the tasks.IsActive(AgentUserSecurityID: Guid): BooleanΔ BC27: Checks if the agent is active.PopulateDefaultProfile(ProfileID: Text[30]; ProfileAppID: Guid; var TempAllProfile: Record "All Profile" temporary)+ BC27: Populates the temporary profile record with the specified information.SetProfile(AgentUserSecurityID: Guid; ProfileID: Text; ProfileAppID: Guid)+ BC27: Assigns the profile to the agent.UpdateLocalizationSettings(AgentUserSecurityID: Guid; LanguageID: Integer; LocaleID: Integer; TimeZone: Text[180])+ BC27 + BC27: Updates the Language, Regional Settings and Time Zone for the agent.GetUserSettings(AgentUserSecurityID: Guid; var UserSettingsRec: Record "User Settings")+ BC27: Gets the user settings for the agent. Few properties are retrieved, like: Profile, Language, Regional Settings and Time Zone.UpdateAccessControl(AgentUserSecurityID: Guid; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)+ BC27: Assigns one or multiple permission sets to the agent. The assignment overrides any existing permission sets.GetAccessControl(AgentUserSecurityID: Guid; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)+ BC27: Gets the permission sets assigned to the agent.GetAgentAccessControl(AgentUserSecurityID: Guid; var TempAgentAccessControl: Record "Agent Access Control" temporary)+ BC27: Gets the users that can manage or give tasks to the agent.UpdateAgentAccessControl(AgentUserSecurityID: Guid; var TempAgentAccessControl: Record "Agent Access Control" temporary)+ BC27: Sets the users that can manage or give tasks to the agent. Existing set of users will be replaced with a new set.SetProfile(AgentUserSecurityID: Guid; var AllProfile: Record "All Profile")+ BC27: Assigns the profile to the agent.ProfileLookup(var UserSettingsRec: Record "User Settings"): Boolean+ BC27: Allows the user to select the new profile for given User Settings for an agent.UpdateLocalizationSettings(AgentUserSecurityID: Guid; var NewUserSettings: Record "User Settings")+ BC27 + BC27: Updates the Language, Regional Settings and Time Zone for the agent.GetUserAccess(AgentUserSecurityID: Guid; var TempAgentAccessControl: Record "Agent Access Control" temporary): Gets the users that can manage or give tasks to the agent.AssignPermissionSet(AgentUserSecurityID: Guid; var TempAccessControlBuffer: Record "Access Control Buffer" temporary)+ BC27 − BC27: Assigns the permission set to the agent.UpdateAccess(AgentUserSecurityID: Guid; var TempAgentAccessControl: Record "Agent Access Control" temporary): Sets the users that can manage or give tasks to the agent. Existing set of users will be replaced with a new set.OpenSetupPageId(AgentMetadataProvider: Enum "Agent Metadata Provider"; AgentUserSecurityID: Guid)+ BC27: Opens the setup page for the specified agent.
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 4301 “Agent Impl.” (27 calls:
Activate → Activate,Archive → Archive,AssignPermissionSet → AssignPermissionSets, …)
Called by
- Codeunit 4325 “Agent Setup Impl.” (8 calls:
CreateAgent → Create,CreateAgent → UpdateLocalizationSettings,GetSetupRecord → GetUserAccess, …) - Codeunit 4350 “Custom Agent Setup” (4 calls:
CreateAgent → Activate,CreateAgent → Deactivate,GetDefaultProfile → PopulateDefaultProfile, …) - Codeunit 4356 “Custom Agent Import” (4 calls:
CreateAgent → SetProfile,CreateAgent → UpdateLocalizationSettings,ReplaceExistingAgent → SetDisplayName, …) - Codeunit 4400 “SOA Setup” (4 calls:
GetDefaultAgentAccessControl → GetUserAccess,GetDefaultProfile → PopulateDefaultProfile,LogTelemetry → GetUserSettings, …) - Page 4350 “Custom Agent Setup” (4 calls:
ApplyUserSettingsValues → SetProfile,InitModelDisplay → GetModelId,InitModelDisplay → GetModelName, …) - Codeunit 3307 “Payables Agent Setup” (2 calls:
ApplyAgentInstructions → SetInstructions,GetDefaultProfile → PopulateDefaultProfile) - Codeunit 4357 “Custom Agent” (2 calls:
GetCustomAgentById → GetUserName,GetCustomAgents → GetUserName) - Codeunit 3313 “PA Annotation” (1 call:
GetAgentAnnotations → IsActive) - Codeunit 3314 “PA Agent Task Execution” (1 call:
GetAgentTaskPageContext → GetUserSettings) - Codeunit 4310 “Agent Task Builder Impl.” (1 call:
VerifyMandatoryFieldsSet → IsActive) - Codeunit 4352 “Custom Agent Instructions” (1 call:
UpdateInstructionsOnSetupRecord → SetInstructions) - Codeunit 4359 “Custom Agent Profile Mgt” (1 call:
TryGetAgentProfile → GetUserSettings) - Codeunit 4399 “SOA Annotation” (1 call:
GetAgentTaskMessageAnnotations → GetDisplayName) - Codeunit 4584 “SOA Recovery” (1 call:
RunSOARecovery → IsActive) - Codeunit 4586 “SOA Dispatcher” (1 call:
CanRunTask → IsActive) - Codeunit 6978 “Upgrade Expense Agent Setup” (1 call:
ClearStaleCopyCompanyStateIfNeeded → GetUserSettings) - Codeunit 6998 “EA Metadata Provider” (1 call:
GetDefaultProfile → PopulateDefaultProfile) - Page 4315 “Agent Card” (1 call:
OpenSetupPage → OpenSetupPageId) - Page 6942 “Expense Agent Setup API” (1 call:
TryGetAgentUserSettings → GetUserSettings) - Page 6991 “Expense Agent Setup Wizard” (1 call:
FindCompanyAgentUserSecurityID → GetUserSettings) - Page extension 3305 “AgentTaskList” (1 call:
CreatePATask → IsActive) - Page extension 4353 “Agent Card” (1 call:
GetCustomAgentFields → GetModelName) - Table 4310 “Agent Setup Buffer” (1 call:
GetUserSettings → GetUserSettings)
Recent changes
- 2026-09-07 #11040 [Agent Archiving] Payables and Expense agent implementation for IAgentArchiving (main, BC30, feature)
- 2026-07-28 #8967 Ability to archive agents (main, BC30, feature)
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"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.