Table 5967 Contract Change Log
- App
- Base Application
- Namespace
- Microsoft.Service.Contract
- Versions
- 17-28
Fields, 13Keys, 2Procedures, 2
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Service/Contract/ContractChangeLog.Table.al147 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 Microsoft.Service.Contract;
using System.Security.AccessControl;
table 5967 "Contract Change Log"
{
Caption = 'Contract Change Log';
DataCaptionFields = "Contract No.";
Permissions = TableData "Contract Change Log" = rimd;
ReplicateData = true;
DataClassification = CustomerContent;
fields
{
field(1; "Contract Type"; Enum "Service Contract Type")
{
Caption = 'Contract Type';
}
field(2; "Contract No."; Code[20])
{
Caption = 'Contract No.';
TableRelation = if ("Contract Type" = const(Contract)) "Service Contract Header"."Contract No." where("Contract Type" = field("Contract Type"));
}
field(3; "Change No."; Integer)
{
Caption = 'Change No.';
}
field(4; "User ID"; Code[50])
{
Caption = 'User ID';
ToolTip = 'Specifies the ID of the user who posted the entry, to be used, for example, in the change log.';
DataClassification = EndUserIdentifiableInformation;
TableRelation = User."User Name";
}
field(5; "Date of Change"; Date)
{
Caption = 'Date of Change';
ToolTip = 'Specifies the date of the change.';
}
field(6; "Time of Change"; Time)
{
Caption = 'Time of Change';
ToolTip = 'Specifies the time of the change.';
}
field(7; "Contract Part"; Option)
{
Caption = 'Contract Part';
ToolTip = 'Specifies the part of the contract that was changed.';
OptionCaption = 'Header,Line,Discount';
OptionMembers = Header,Line,Discount;
}
field(8; "Field Description"; Text[100])
{
Caption = 'Field Description';
ToolTip = 'Specifies the description of the field that was modified.';
}
field(9; "Old Value"; Text[100])
{
Caption = 'Old Value';
ToolTip = 'Specifies the contents of the modified field before the change takes place.';
}
field(10; "New Value"; Text[100])
{
Caption = 'New Value';
ToolTip = 'Specifies the contents of the modified field after the change has taken place.';
}
field(12; "Type of Change"; Option)
{
Caption = 'Type of Change';
ToolTip = 'Specifies the type of change on the contract.';
OptionCaption = 'Modify,Insert,Delete,Rename';
OptionMembers = Modify,Insert,Delete,Rename;
}
field(13; "Service Item No."; Code[20])
{
Caption = 'Service Item No.';
ToolTip = 'Specifies the number of the item on the service contract line, for which a log entry was created.';
}
field(14; "Serv. Contract Line No."; Integer)
{
Caption = 'Serv. Contract Line No.';
ToolTip = 'Specifies the number of the service contract line for which a log entry was created.';
}
}
keys
{
key(Key1; "Contract No.", "Change No.")
{
Clustered = true;
}
key(Key2; "Contract Type")
{
}
}
fieldgroups
{
}
var
ContractChangeLog: Record "Contract Change Log";
NextChangeNo: Integer;
procedure LogContractChange(ContractNo: Code[20]; ContractPart: Option Header,Line,Discount; FieldName: Text; ChangeType: Integer; OldValue: Text[100]; NewValue: Text[100]; ServItemNo: Code[20]; ServContractLineNo: Integer)
begin
ContractChangeLog.Reset();
ContractChangeLog.LockTable();
ContractChangeLog.SetRange("Contract No.", ContractNo);
if ContractChangeLog.FindLast() then
NextChangeNo := ContractChangeLog."Change No." + 1
else
NextChangeNo := 1;
ContractChangeLog.Init();
ContractChangeLog."Contract Type" := ContractChangeLog."Contract Type"::Contract;
ContractChangeLog."Contract No." := ContractNo;
ContractChangeLog."User ID" := CopyStr(UserId(), 1, MaxStrLen("User ID"));
ContractChangeLog."Date of Change" := Today;
ContractChangeLog."Time of Change" := Time;
ContractChangeLog."Change No." := NextChangeNo;
ContractChangeLog."Contract Part" := ContractPart;
ContractChangeLog."Service Item No." := ServItemNo;
ContractChangeLog."Serv. Contract Line No." := ServContractLineNo;
case ChangeType of
0:
ContractChangeLog."Type of Change" := ContractChangeLog."Type of Change"::Modify;
1:
ContractChangeLog."Type of Change" := ContractChangeLog."Type of Change"::Insert;
2:
ContractChangeLog."Type of Change" := ContractChangeLog."Type of Change"::Delete;
3:
ContractChangeLog."Type of Change" := ContractChangeLog."Type of Change"::Rename;
end;
ContractChangeLog."Field Description" := CopyStr(FieldName, 1, MaxStrLen(ContractChangeLog."Field Description"));
ContractChangeLog."Old Value" := OldValue;
ContractChangeLog."New Value" := NewValue;
ContractChangeLog.Insert();
end;
}