From 77e7e9c945500f74011957077ae2b01d632b8c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krupinszki?= Date: Thu, 20 Aug 2026 16:42:18 +0200 Subject: [PATCH 1/6] IsArchivingSupported added --- .../App/Agent/Setup/AgentCard.Page.al | 2 +- .../App/Agent/Setup/AgentImpl.Codeunit.al | 16 ++++++++++++++++ .../App/Agent/Setup/AgentList.Page.al | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/System Application/App/Agent/Setup/AgentCard.Page.al b/src/System Application/App/Agent/Setup/AgentCard.Page.al index c4d8987ec25..15a523d421e 100644 --- a/src/System Application/App/Agent/Setup/AgentCard.Page.al +++ b/src/System Application/App/Agent/Setup/AgentCard.Page.al @@ -255,7 +255,7 @@ page 4315 "Agent Card" CopilotAvailabilityTxt := AgentImpl.GetCopilotAvailabilityDisplayText(Rec); AgentIsArchived := Rec.Substate = Rec.Substate::Archived; - ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent"; + ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent" and AgentImpl.IsArchivingSupported(Rec); StateEditable := not AgentIsArchived; end; diff --git a/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al b/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al index f79cf8435dd..7c04f3053b6 100644 --- a/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al +++ b/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al @@ -66,6 +66,9 @@ codeunit 4301 "Agent Impl." if Agent.Substate = Agent.Substate::Archived then exit; // Archiving is terminal; idempotent no-op avoids the platform "archived agent cannot be modified" error on re-archive. + if not IsArchivingSupported(Agent) then + Error(ArchivingNotSupportedErr); + if Agent.State <> Agent.State::Disabled then Error(DeactivateBeforeArchivingErr); @@ -73,6 +76,18 @@ codeunit 4301 "Agent Impl." Agent.Modify(true); end; + procedure IsArchivingSupported(Agent: Record Agent): Boolean + var + AgentArchiving: Interface IAgentArchiving; + begin + if IsNullGuid(Agent."User Security ID") then + exit(false); + + AgentArchiving := Agent."Agent Metadata Provider"; + + exit(AgentArchiving.IsArchivingSupported()); + end; + procedure IsArchived(AgentUserSecurityID: Guid): Boolean var Agent: Record Agent; @@ -628,6 +643,7 @@ codeunit 4301 "Agent Impl." AgentDoesNotExistErr: Label 'Agent does not exist.'; AgentArchivedCannotBeModifiedErr: Label 'The agent is archived and cannot be modified.'; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.'; + ArchivingNotSupportedErr: Label 'This type of agent cannot be archived yet.'; AutoLbl: Label 'Auto'; NoActiveAgentsErr: Label 'There are no active agents setup on the system.'; NoAgentsAvailableNotificationLbl: Label 'Business Central agents are currently not available in your country.'; diff --git a/src/System Application/App/Agent/Setup/AgentList.Page.al b/src/System Application/App/Agent/Setup/AgentList.Page.al index 4237cb0de76..a128db3ffd7 100644 --- a/src/System Application/App/Agent/Setup/AgentList.Page.al +++ b/src/System Application/App/Agent/Setup/AgentList.Page.al @@ -269,7 +269,7 @@ page 4316 "Agent List" begin CopilotAvailabilityTxt := AgentImpl.GetCopilotAvailabilityDisplayText(Rec); AgentIsArchived := Rec.Substate = Rec.Substate::Archived; - ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent"; + ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent" and AgentImpl.IsArchivingSupported(Rec); end; local procedure SetCompanyFilter() From 43e74c7faa5677d51456ca890e48db790a7fba8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krupinszki?= Date: Thu, 20 Aug 2026 16:42:35 +0200 Subject: [PATCH 2/6] PA set IsArchivingSupported to false --- .../Integration/PAAgentArchiving.Codeunit.al | 20 +++++++++++++++++++ .../app/PAAgentMetadata.EnumExt.al | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al diff --git a/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al b/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al new file mode 100644 index 00000000000..02c73af4b90 --- /dev/null +++ b/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al @@ -0,0 +1,20 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.Agent.PayablesAgent; + +using System.Agents; + +codeunit 3319 "PA Agent Archiving" implements IAgentArchiving +{ + Access = Internal; + InherentEntitlements = X; + InherentPermissions = X; + + procedure IsArchivingSupported(): Boolean + begin + exit(false); + end; +} \ No newline at end of file diff --git a/src/Apps/W1/PayablesAgent/app/PAAgentMetadata.EnumExt.al b/src/Apps/W1/PayablesAgent/app/PAAgentMetadata.EnumExt.al index 3a6b1496e0c..0ea2395884e 100644 --- a/src/Apps/W1/PayablesAgent/app/PAAgentMetadata.EnumExt.al +++ b/src/Apps/W1/PayablesAgent/app/PAAgentMetadata.EnumExt.al @@ -13,6 +13,6 @@ enumextension 3304 "PA Agent Metadata" extends "Agent Metadata Provider" value(3303; "Payables Agent") { Caption = 'Payables Agent', Locked = true; - Implementation = IAgentFactory = "Payables Agent", IAgentMetadata = "Payables Agent", IAgentTaskExecution = "PA Agent Task Execution"; + Implementation = IAgentFactory = "Payables Agent", IAgentMetadata = "Payables Agent", IAgentTaskExecution = "PA Agent Task Execution", IAgentArchiving = "PA Agent Archiving"; } } From a0b08e52ac0a6ca54237680b648c5c498347b264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krupinszki?= Date: Thu, 20 Aug 2026 17:14:05 +0200 Subject: [PATCH 3/6] EA opt out of archiving capability --- .../Codeunits/EAAgentArchiving.Codeunit.al | 21 +++++++++++++++++++ .../EnumExtensions/EAAgentMetadata.EnumExt.al | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al new file mode 100644 index 00000000000..8c2f6fee531 --- /dev/null +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al @@ -0,0 +1,21 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +#pragma warning disable AS0007 +namespace Microsoft.ExpenseAgent; + +using System.Agents; + +codeunit 7104 "EA Agent Archiving" implements IAgentArchiving +{ + Access = Internal; + InherentEntitlements = X; + InherentPermissions = X; + + procedure IsArchivingSupported(): Boolean + begin + exit(false); + end; +} diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/EnumExtensions/EAAgentMetadata.EnumExt.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/EnumExtensions/EAAgentMetadata.EnumExt.al index cdb7dfefee6..061d575a942 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Setup/EnumExtensions/EAAgentMetadata.EnumExt.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/EnumExtensions/EAAgentMetadata.EnumExt.al @@ -13,6 +13,6 @@ enumextension 6998 "EA Agent Metadata" extends "Agent Metadata Provider" value(6998; "Expense Agent") { Caption = 'Expense Agent', Locked = true; - Implementation = IAgentFactory = "EA Metadata Provider", IAgentMetadata = "EA Metadata Provider", IAgentTaskExecution = "EA Agent Task Execution"; + Implementation = IAgentFactory = "EA Metadata Provider", IAgentMetadata = "EA Metadata Provider", IAgentTaskExecution = "EA Agent Task Execution", IAgentArchiving = "EA Agent Archiving"; } } From 2d90809acf29d166dcf269c367268c8206485bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krupinszki?= Date: Mon, 24 Aug 2026 21:26:44 +0200 Subject: [PATCH 4/6] PR feedback --- .../Codeunits/EAAgentArchiving.Codeunit.al | 1 - .../Integration/PAAgentArchiving.Codeunit.al | 2 +- .../App/Agent/Setup/Agent.Codeunit.al | 14 ++++++++ .../App/Agent/Setup/AgentCard.Page.al | 6 +++- .../App/Agent/Setup/AgentImpl.Codeunit.al | 15 +++++++-- .../App/Agent/Setup/AgentList.Page.al | 6 +++- .../Test/Agent/src/SDK/AgentTest.Codeunit.al | 33 +++++++++++++++++++ .../src/Setup/LibraryMockAgent.codeunit.al | 2 +- .../Integration/MockAgentMetaProv.Codeunit.al | 7 +++- .../Integration/MockAgentMetaProv.EnumExt.al | 6 ++++ 10 files changed, 83 insertions(+), 9 deletions(-) diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al index 8c2f6fee531..25d818bf06e 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/Codeunits/EAAgentArchiving.Codeunit.al @@ -3,7 +3,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // ------------------------------------------------------------------------------------------------ -#pragma warning disable AS0007 namespace Microsoft.ExpenseAgent; using System.Agents; diff --git a/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al b/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al index 02c73af4b90..36fe3bef3d5 100644 --- a/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al +++ b/src/Apps/W1/PayablesAgent/app/Integration/PAAgentArchiving.Codeunit.al @@ -17,4 +17,4 @@ codeunit 3319 "PA Agent Archiving" implements IAgentArchiving begin exit(false); end; -} \ No newline at end of file +} diff --git a/src/System Application/App/Agent/Setup/Agent.Codeunit.al b/src/System Application/App/Agent/Setup/Agent.Codeunit.al index 4f882e0b9e9..b802c4d826b 100644 --- a/src/System Application/App/Agent/Setup/Agent.Codeunit.al +++ b/src/System Application/App/Agent/Setup/Agent.Codeunit.al @@ -61,6 +61,7 @@ codeunit 4321 Agent /// 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. /// /// The user security ID of the agent. + /// An error is raised if the agent's type does not support archiving. Call IsArchivingSupported to check before archiving. procedure Archive(AgentUserSecurityID: Guid) var AgentImpl: Codeunit "Agent Impl."; @@ -69,6 +70,19 @@ codeunit 4321 Agent AgentImpl.Archive(AgentUserSecurityID); end; + /// + /// Checks if the agent type supports archiving. + /// + /// The user security ID of the agent. + /// True if the agent type supports archiving; otherwise false. + procedure IsArchivingSupported(AgentUserSecurityID: Guid): Boolean + var + AgentImpl: Codeunit "Agent Impl."; + begin + FeatureAccessManagement.AgentManagementAllowed(true); + exit(AgentImpl.IsArchivingSupported(AgentUserSecurityID)); + end; + /// /// Checks if the agent is archived. /// diff --git a/src/System Application/App/Agent/Setup/AgentCard.Page.al b/src/System Application/App/Agent/Setup/AgentCard.Page.al index 15a523d421e..628335a6346 100644 --- a/src/System Application/App/Agent/Setup/AgentCard.Page.al +++ b/src/System Application/App/Agent/Setup/AgentCard.Page.al @@ -151,6 +151,9 @@ page 4315 "Agent Card" Agent: Codeunit Agent; ArchiveConfirmation: Page "Agent Archive Confirmation"; begin + if not Agent.IsArchivingSupported(Rec."User Security ID") then + Error(ArchivingNotSupportedErr, Rec."Agent Metadata Provider"); + if Rec.State <> Rec.State::Disabled then Error(DeactivateBeforeArchivingErr); @@ -255,7 +258,7 @@ page 4315 "Agent Card" CopilotAvailabilityTxt := AgentImpl.GetCopilotAvailabilityDisplayText(Rec); AgentIsArchived := Rec.Substate = Rec.Substate::Archived; - ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent" and AgentImpl.IsArchivingSupported(Rec); + ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent"; StateEditable := not AgentIsArchived; end; @@ -324,6 +327,7 @@ page 4315 "Agent Card" YouCannotEnableAgentWithoutUsingConfigurationPageErr: Label 'You can''t activate the agent from this page. Use the action to configure and activate the agent.'; YouDoNotHavePermissionToModifyThisAgentErr: Label 'You do not have permission to modify this agent. Contact your system administrator to update your permissions or to mark you as one of the administrators for the agent.'; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.'; + ArchivingNotSupportedErr: Label 'Archiving agents of type ''%1'' is not supported.', Comment = '%1 = the type of the agent.'; AgentArchivedMsg: Label 'The agent has been archived.'; AgentArchivedNotificationMsg: Label 'This agent is archived and can no longer be modified. Its tasks and logs remain available for auditing.'; } \ No newline at end of file diff --git a/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al b/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al index 7c04f3053b6..abe54c09a92 100644 --- a/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al +++ b/src/System Application/App/Agent/Setup/AgentImpl.Codeunit.al @@ -67,7 +67,7 @@ codeunit 4301 "Agent Impl." exit; // Archiving is terminal; idempotent no-op avoids the platform "archived agent cannot be modified" error on re-archive. if not IsArchivingSupported(Agent) then - Error(ArchivingNotSupportedErr); + Error(ArchivingNotSupportedErr, Agent."Agent Metadata Provider"); if Agent.State <> Agent.State::Disabled then Error(DeactivateBeforeArchivingErr); @@ -76,7 +76,16 @@ codeunit 4301 "Agent Impl." Agent.Modify(true); end; - procedure IsArchivingSupported(Agent: Record Agent): Boolean + procedure IsArchivingSupported(AgentUserSecurityID: Guid): Boolean + var + Agent: Record Agent; + begin + GetAgent(Agent, AgentUserSecurityID); + + exit(IsArchivingSupported(Agent)); + end; + + local procedure IsArchivingSupported(Agent: Record Agent): Boolean var AgentArchiving: Interface IAgentArchiving; begin @@ -643,7 +652,7 @@ codeunit 4301 "Agent Impl." AgentDoesNotExistErr: Label 'Agent does not exist.'; AgentArchivedCannotBeModifiedErr: Label 'The agent is archived and cannot be modified.'; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.'; - ArchivingNotSupportedErr: Label 'This type of agent cannot be archived yet.'; + ArchivingNotSupportedErr: Label 'Archiving agents of type ''%1'' is not supported.', Comment = '%1 = the type of the agent.'; AutoLbl: Label 'Auto'; NoActiveAgentsErr: Label 'There are no active agents setup on the system.'; NoAgentsAvailableNotificationLbl: Label 'Business Central agents are currently not available in your country.'; diff --git a/src/System Application/App/Agent/Setup/AgentList.Page.al b/src/System Application/App/Agent/Setup/AgentList.Page.al index a128db3ffd7..a4afa4965f6 100644 --- a/src/System Application/App/Agent/Setup/AgentList.Page.al +++ b/src/System Application/App/Agent/Setup/AgentList.Page.al @@ -99,6 +99,9 @@ page 4316 "Agent List" if Rec.IsEmpty() then Error(NoAgentSetupErr); + if not Agent.IsArchivingSupported(Rec."User Security ID") then + Error(ArchivingNotSupportedErr, Rec."Agent Metadata Provider"); + if Agent.IsActive(Rec."User Security ID") then Error(DeactivateBeforeArchivingErr); @@ -269,7 +272,7 @@ page 4316 "Agent List" begin CopilotAvailabilityTxt := AgentImpl.GetCopilotAvailabilityDisplayText(Rec); AgentIsArchived := Rec.Substate = Rec.Substate::Archived; - ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent" and AgentImpl.IsArchivingSupported(Rec); + ArchiveActionEnabled := (not AgentIsArchived) and Rec."Can Curr. User Configure Agent"; end; local procedure SetCompanyFilter() @@ -302,4 +305,5 @@ page 4316 "Agent List" AgentIsArchived: Boolean; NoAgentSetupErr: Label 'No agents have been setup. You must set up an agent first.'; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.'; + ArchivingNotSupportedErr: Label 'Archiving agents of type ''%1'' is not supported.', Comment = '%1 = the type of the agent.'; } \ No newline at end of file diff --git a/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al b/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al index 3c3110d4563..6f64e2b44f1 100644 --- a/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al +++ b/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al @@ -22,6 +22,7 @@ codeunit 133961 "Agent Test" LibraryVariableStorage: Codeunit "Library - Variable Storage"; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.', Locked = true; AgentArchivedCannotBeModifiedErr: Label 'The agent is archived and cannot be modified.', Locked = true; + ArchivingNotSupportedErr: Label 'is not supported', Locked = true; local procedure Initialize() begin @@ -992,6 +993,7 @@ codeunit 133961 "Agent Test" Agent.Deactivate(AgentId); Assert.IsFalse(Agent.IsArchived(AgentId), 'Agent should not be archived initially'); + Assert.IsTrue(Agent.IsArchivingSupported(AgentId), 'Archiving should be supported for a type that does not opt out'); // [WHEN] Archiving the agent Agent.Archive(AgentId); @@ -1004,6 +1006,37 @@ codeunit 133961 "Agent Test" Assert.AreEqual(AgentRecord.Substate::Archived, AgentRecord.Substate, 'Agent substate should be Archived'); end; + [Test] + procedure ArchiveAgentOfUnsupportedTypeErrors() + var + AgentRecord: Record Agent; + TempAgentAccessControl: Record "Agent Access Control" temporary; + Any: Codeunit Any; + AgentId: Guid; + AgentUserName: Code[50]; + begin + Initialize(); + + // [SCENARIO] Archiving an agent whose type opts out of archiving is rejected + + // [GIVEN] An agent of a type that reports archiving as unsupported + AgentUserName := CopyStr(Any.AlphanumericText(MaxStrLen(AgentRecord."User Name")), 1, MaxStrLen(AgentRecord."User Name")); + AgentId := Agent.Create( + "Agent Metadata Provider"::"SDK Mock Agent No Archiving", + AgentUserName, + CopyStr(Any.AlphanumericText(80), 1, 80), + TempAgentAccessControl); + + // [THEN] Archiving is reported as unsupported for that agent + Assert.IsFalse(Agent.IsArchivingSupported(AgentId), 'Archiving should not be supported for this agent type'); + + // [WHEN] Archiving the agent + // [THEN] An error is raised and the agent is not archived + asserterror Agent.Archive(AgentId); + Assert.ExpectedError(ArchivingNotSupportedErr); + Assert.IsFalse(Agent.IsArchived(AgentId), 'Agent should not be archived'); + end; + [Test] procedure ArchiveActiveAgentErrors() var diff --git a/src/System Application/Test/Agent/src/Setup/LibraryMockAgent.codeunit.al b/src/System Application/Test/Agent/src/Setup/LibraryMockAgent.codeunit.al index 933e0f04381..a35be59b12f 100644 --- a/src/System Application/Test/Agent/src/Setup/LibraryMockAgent.codeunit.al +++ b/src/System Application/Test/Agent/src/Setup/LibraryMockAgent.codeunit.al @@ -49,7 +49,7 @@ codeunit 133954 "Library Mock Agent" AgentRecord: Record Agent; MockAgentSetup: Record "Mock Agent Setup"; begin - AgentRecord.SetRange("Agent Metadata Provider", AgentRecord."Agent Metadata Provider"::"SDK Mock Agent"); + AgentRecord.SetFilter("Agent Metadata Provider", '%1|%2', AgentRecord."Agent Metadata Provider"::"SDK Mock Agent", AgentRecord."Agent Metadata Provider"::"SDK Mock Agent No Archiving"); if AgentRecord.FindSet() then repeat if MockAgentSetup.Get(AgentRecord."User Security ID") then diff --git a/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.Codeunit.al b/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.Codeunit.al index fba61972d23..fd5c5b19fef 100644 --- a/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.Codeunit.al +++ b/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.Codeunit.al @@ -10,7 +10,7 @@ using System.AI; using System.Reflection; using System.Security.AccessControl; -codeunit 133952 "Mock Agent Meta. Prov." implements IAgentMetadata, IAgentFactory +codeunit 133952 "Mock Agent Meta. Prov." implements IAgentMetadata, IAgentFactory, IAgentArchiving { InherentEntitlements = X; InherentPermissions = X; @@ -21,6 +21,11 @@ codeunit 133952 "Mock Agent Meta. Prov." implements IAgentMetadata, IAgentFactor MockAgentSetup: Codeunit "Mock Agent Setup"; MockAgentInitialLbl: Label 'MA', MaxLength = 4; + procedure IsArchivingSupported(): Boolean + begin + exit(false); + end; + procedure GetDefaultInitials(): Text[4] begin exit(MockAgentInitialLbl); diff --git a/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.EnumExt.al b/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.EnumExt.al index 4a309e58cf5..75888285417 100644 --- a/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.EnumExt.al +++ b/src/System Application/Test/Agent/src/Setup/MockAgent/Integration/MockAgentMetaProv.EnumExt.al @@ -13,4 +13,10 @@ enumextension 133952 "Mock Agent Meta. Prov." extends "Agent Metadata Provider" Caption = 'SDK Mock Agent'; Implementation = IAgentFactory = "Mock Agent Meta. Prov.", IAgentMetadata = "Mock Agent Meta. Prov."; } + + value(133955; "SDK Mock Agent No Archiving") + { + Caption = 'SDK Mock Agent No Archiving'; + Implementation = IAgentFactory = "Mock Agent Meta. Prov.", IAgentMetadata = "Mock Agent Meta. Prov.", IAgentArchiving = "Mock Agent Meta. Prov."; + } } From 1ad61a3e1969901dfedb0d6ae9192a75b2f1ad25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krupinszki?= Date: Mon, 24 Aug 2026 22:12:03 +0200 Subject: [PATCH 5/6] Add missing trailing newlines on agent setup pages Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9724257d-43d1-468b-9f97-1fb863d2fdd1 --- src/System Application/App/Agent/Setup/AgentCard.Page.al | 2 +- src/System Application/App/Agent/Setup/AgentList.Page.al | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System Application/App/Agent/Setup/AgentCard.Page.al b/src/System Application/App/Agent/Setup/AgentCard.Page.al index 628335a6346..ec0257e8a96 100644 --- a/src/System Application/App/Agent/Setup/AgentCard.Page.al +++ b/src/System Application/App/Agent/Setup/AgentCard.Page.al @@ -330,4 +330,4 @@ page 4315 "Agent Card" ArchivingNotSupportedErr: Label 'Archiving agents of type ''%1'' is not supported.', Comment = '%1 = the type of the agent.'; AgentArchivedMsg: Label 'The agent has been archived.'; AgentArchivedNotificationMsg: Label 'This agent is archived and can no longer be modified. Its tasks and logs remain available for auditing.'; -} \ No newline at end of file +} diff --git a/src/System Application/App/Agent/Setup/AgentList.Page.al b/src/System Application/App/Agent/Setup/AgentList.Page.al index a4afa4965f6..0f825e1a801 100644 --- a/src/System Application/App/Agent/Setup/AgentList.Page.al +++ b/src/System Application/App/Agent/Setup/AgentList.Page.al @@ -306,4 +306,4 @@ page 4316 "Agent List" NoAgentSetupErr: Label 'No agents have been setup. You must set up an agent first.'; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.'; ArchivingNotSupportedErr: Label 'Archiving agents of type ''%1'' is not supported.', Comment = '%1 = the type of the agent.'; -} \ No newline at end of file +} From d863938f89ccad771bade5245fba5f9c9a4a659e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Krupinszki?= Date: Wed, 26 Aug 2026 09:47:47 +0200 Subject: [PATCH 6/6] Assert the full unsupported-archiving error message in the negative test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9724257d-43d1-468b-9f97-1fb863d2fdd1 --- .../Test/Agent/src/SDK/AgentTest.Codeunit.al | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al b/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al index 79cd1b62dc0..a28b01df367 100644 --- a/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al +++ b/src/System Application/Test/Agent/src/SDK/AgentTest.Codeunit.al @@ -23,7 +23,7 @@ codeunit 133961 "Agent Test" LibraryVariableStorage: Codeunit "Library - Variable Storage"; DeactivateBeforeArchivingErr: Label 'Deactivate the agent before archiving it.', Locked = true; AgentArchivedCannotBeModifiedErr: Label 'The agent is archived and cannot be modified.', Locked = true; - ArchivingNotSupportedErr: Label 'is not supported', Locked = true; + ArchivingNotSupportedErr: Label 'Archiving agents of type ''%1'' is not supported.', Locked = true; local procedure Initialize() begin @@ -1034,7 +1034,7 @@ codeunit 133961 "Agent Test" // [WHEN] Archiving the agent // [THEN] An error is raised and the agent is not archived asserterror Agent.Archive(AgentId); - Assert.ExpectedError(ArchivingNotSupportedErr); + Assert.ExpectedError(StrSubstNo(ArchivingNotSupportedErr, "Agent Metadata Provider"::"SDK Mock Agent No Archiving")); Assert.IsFalse(Agent.IsArchived(AgentId), 'Agent should not be archived'); end;