Skip to content

Commit

Permalink
Addin feature to add tables that you don't want to track deleted reco…
Browse files Browse the repository at this point in the history
…rds.
  • Loading branch information
Bertverbeek4PS committed Oct 21, 2024
1 parent 6e5fa2e commit f54ce45
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
1 change: 1 addition & 0 deletions businessCentral/app/permissions/Execute.PermissionSet.al
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ permissionset 82561 "ADLSE - Execute"
tabledata "ADLSE Run" = RIMD,
tabledata "ADLSE Enum Translation" = RIMD,
tabledata "ADLSE Enum Translation Lang" = RIMD,
tabledata "Deleted Tables Not to Sync" = R,
codeunit "ADLSE UpgradeTagNewCompanySubs" = X,
codeunit "ADLSE Upgrade" = X,
codeunit "ADLSE Util" = X,
Expand Down
1 change: 1 addition & 0 deletions businessCentral/app/permissions/Setup.PermissionSet.al
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ permissionset 82560 "ADLSE - Setup"
tabledata "ADLSE Run" = RD,
tabledata "ADLSE Enum Translation" = RIMD,
tabledata "ADLSE Enum Translation Lang" = RIMD,
tabledata "Deleted Tables Not to Sync" = RIMD,
codeunit "ADLSE Clear Tracked Deletions" = X,
codeunit "ADLSE Credentials" = X,
codeunit "ADLSE Setup" = X,
Expand Down
43 changes: 43 additions & 0 deletions businessCentral/app/src/DeletedTablesNotToSync.Page.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
page 82564 "Deleted Tables Not To Sync"
{
PageType = List;
ApplicationArea = All;
SourceTable = "Deleted Tables Not to Sync";

layout
{
area(Content)
{
repeater(GroupName)
{
field(TableId; rec.TableId)
{
trigger OnLookup(var Text: Text): Boolean
var
TableMetadata: Record "Table Metadata";
begin
GetTableId(TableMetadata);
if Page.RunModal(Page::"Available Table Selection List", TableMetadata) = Action::LookupOK then
rec.TableId := TableMetadata.ID;
end;
}
field("Table Caption"; rec."Table Caption") { }
}
}
}
local procedure GetTableId(var TableMetadata: Record "Table Metadata")
var
ADLSETable: Record "ADLSE Table";
TableFilterTxt: Text;
begin
ADLSETable.Reset();
if ADLSETable.FindSet() then
repeat
if TableFilterTxt = '' then
TableFilterTxt := Format(ADLSETable."Table ID")
else
TableFilterTxt += '|' + Format(ADLSETable."Table ID");
until ADLSETable.Next() = 0;
TableMetadata.SetFilter(TableMetadata.ID, TableFilterTxt);
end;
}
31 changes: 31 additions & 0 deletions businessCentral/app/src/DeletedTablesNotToSync.Table.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
table 82569 "Deleted Tables Not to Sync"
{
DataClassification = ToBeClassified;

fields
{
field(1; TableId; Integer)
{
DataClassification = ToBeClassified;
TableRelation = "ADLSE Table"."Table ID";
Caption = 'Table ID';
ToolTip = 'Specify the ID of the table that should not be tracked for deletes.';
}
field(5; "Table Caption"; Text[100])
{
CalcFormula = lookup(AllObjWithCaption."Object Name" where("Object ID" = field(TableId)));
Caption = 'Table Caption';
Editable = false;
FieldClass = FlowField;
ToolTip = 'Specifies the caption of the table whose data is to exported.';
}
}

keys
{
key(Key1; TableId)
{
Clustered = true;
}
}
}
7 changes: 3 additions & 4 deletions businessCentral/app/src/Execution.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@ codeunit 82569 "ADLSE Execution"
var
ADLSETableLastTimestamp: Record "ADLSE Table Last Timestamp";
ADLSEDeletedRecord: Record "ADLSE Deleted Record";
DeletedTablesNottoSync: Record "Deleted Tables Not to Sync";
begin
// exit function for tables that you do not wish to sync deletes for
// you should also consider not registering for deletes for the table in the function GetDatabaseTableTriggerSetup above.
// if RecRef.Number = Database::"G/L Entry" then
// exit;
if DeletedTablesNottoSync.Get(RecRef.Number) then
exit;

// check if table is to be tracked.
if not ADLSETableLastTimestamp.ExistsUpdatedLastTimestamp(RecRef.Number) then
Expand Down
8 changes: 8 additions & 0 deletions businessCentral/app/src/Setup.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ page 82560 "ADLSE Setup"
Image = Translations;
RunObject = page "ADLSE Enum Translations";
}
action(DeletedTablesNotToSync)
{
ApplicationArea = All;
Caption = 'Deleted tables not to sync';
ToolTip = 'Shows all the tables that are specified not to be tracked for deletes.';
Image = Delete;
RunObject = page "Deleted Tables Not To Sync";
}
}
area(Promoted)
{
Expand Down

0 comments on commit f54ce45

Please sign in to comment.