Codeunit 3112 Activity Log Builder Impl. in 27

App
System Application
Namespace
System.Log

Procedures, 8

Versions171819202122232425262728latest

Source26272829

Source in 27

src/System Application/App/ActivityLog/src/ActivityLogBuilderImpl.Codeunit.al79 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.Log;

using System;

codeunit 3112 "Activity Log Builder Impl."
{
    Access = Internal;
    InherentPermissions = X;
    InherentEntitlements = X;

    var
        LogEntry: DotNet ActivityLogEntry;
        AttributeType: DotNet ActivityLogAttribute;
        GlobalFieldNo: Integer;
        BuilderNotInitializedErr: Label 'Activity Log Builder not initialized.';
        ConfidenceInvalidErr: Label 'Confidence value %1 is invalid. Allowed values are Low, Medium, High.', Comment = '%1 - Confidence value';

    procedure Init(TableNo: Integer; FieldNo: Integer; RecSystemId: Guid): Codeunit "Activity Log Builder Impl."
    begin
        Clear(LogEntry);
        LogEntry := LogEntry.Create(TableNo, RecSystemId);
        this.GlobalFieldNo := FieldNo;
        exit(this);
    end;

    procedure SetExplanation(Explanation: Text): Codeunit "Activity Log Builder Impl."
    begin
        LogEntry.AddFieldAttribute(this.GlobalFieldNo, AttributeType::Explanation, Explanation);
        exit(this);
    end;

    procedure SetType(Type: Enum "Activity Log Type"): Codeunit "Activity Log Builder Impl."
    begin
        LogEntry.AddFieldAttribute(this.GlobalFieldNo, AttributeType::Type, Format(Type));
        exit(this);
    end;

    procedure SetReferenceSource(PageId: Integer; var Rec: RecordRef): Codeunit "Activity Log Builder Impl."
    var
        TextURL: Text;
    begin
        TextURL := System.GetUrl(CurrentClientType(), CompanyName(), ObjectType::Page, PageId, Rec, false);
        LogEntry.AddFieldAttribute(this.GlobalFieldNo, AttributeType::ReferenceSource, TextURL);
        exit(this);
    end;

    procedure SetReferenceSource(ReferenceSource: Text): Codeunit "Activity Log Builder Impl."
    begin
        LogEntry.AddFieldAttribute(this.GlobalFieldNo, AttributeType::ReferenceSource, ReferenceSource);
        exit(this);
    end;

    procedure SetConfidence(Confidence: Text): Codeunit "Activity Log Builder Impl."
    begin
        if not (Confidence in ['Low', 'Medium', 'High']) then
            Error(ConfidenceInvalidErr, Confidence);

        LogEntry.AddFieldAttribute(this.GlobalFieldNo, AttributeType::Confidence, Confidence);
        exit(this);
    end;

    procedure SetReferenceTitle(ReferenceTitle: Text): Codeunit "Activity Log Builder Impl."
    begin
        LogEntry.AddFieldAttribute(this.GlobalFieldNo, AttributeType::ReferenceTitle, ReferenceTitle);
        exit(this);
    end;

    procedure Log()
    begin
        if GlobalFieldNo = 0 then
            Error(BuilderNotInitializedErr);
        LogEntry.Log();
    end;

}

Procedures, 8

NameParametersReturnsAccessObsolete
Init(Integer, Integer, Guid)Codeunit Activity Log Builder Impl.public-
SetExplanation(Text)Codeunit Activity Log Builder Impl.public-
SetType(Enum Activity Log Type)Codeunit Activity Log Builder Impl.public-
SetReferenceSource(Integer, var RecordRef)Codeunit Activity Log Builder Impl.public-
SetReferenceSource(Text)Codeunit Activity Log Builder Impl.public-
SetReferenceTitle(Text)Codeunit Activity Log Builder Impl.public-
Log()public-
SetConfidence(Text)Codeunit Activity Log Builder Impl.public-