Codeunit 4313 Agent Session Impl.

App
System Application
Namespace
System.Agents
Versions
26, not in 28

Procedures, 3

Versions171819202122232425262728

Source26

Source in 26

src/System Application/App/Agent/Interaction/Internal/AgentSessionImpl.Codeunit.al45 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.Agents;

codeunit 4313 "Agent Session Impl."
{
    Access = Internal;
    InherentEntitlements = X;
    InherentPermissions = X;

    procedure IsAgentSession(var ActiveAgentMetadataProvider: Enum "Agent Metadata Provider"): Boolean
    var
        AgentType: Integer;
        AgentALFunctions: DotNet AgentALFunctions;
    begin
        if not GuiAllowed() then
            exit(false);

        AgentType := AgentALFunctions.GetSessionAgentMetadataProviderType();
        if AgentType < 0 then
            exit(false);

        ActiveAgentMetadataProvider := "Agent Metadata Provider".FromInteger(AgentType);
        exit(true);
    end;

    procedure BlockPageFromBeingOpenedByAgent()
    var
        AgentMetadataProvider: Enum "Agent Metadata Provider";
        ThisPageCannotBeOpenedByAnAgentErr: Label 'This page cannot be opened by an agent.', Locked = true;
    begin
        if IsAgentSession(AgentMetadataProvider) then
            Error(ThisPageCannotBeOpenedByAnAgentErr);
    end;

    procedure GetCurrentSessionAgentTaskId(): Integer
    var
        AgentALFunctions: DotNet AgentALFunctions;
    begin
        exit(AgentALFunctions.GetSessionAgentTaskId());
    end;
}