Codeunit 3112 Activity Log Builder Impl., source in 29
src/System Application/App/ActivityLog/src/ActivityLogBuilderImpl.Codeunit.al86 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;
procedure Query(TableNo: Integer; RecSystemId: Guid): Text
var
QueryEntry: DotNet ActivityLogEntry;
begin
exit(QueryEntry.Query(TableNo, RecSystemId));
end;
}