Skip to content

Commit 879220a

Browse files
authored
[releases/25.2] Remove emailinbox retention policy, just keep allowed tables (#2477)
This pull request backports #2475 to releases/25.2 Fixes [AB#560013](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/560013)
1 parent f6a6778 commit 879220a

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

src/System Application/App/Email/src/EmailInstaller.Codeunit.al

+1-40
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ codeunit 1596 "Email Installer"
3131
procedure AddRetentionPolicyAllowedTables()
3232
begin
3333
AddRetentionPolicyAllowedTables(false);
34-
CreateRetentionPolicySetup(false);
3534
end;
3635

3736
procedure AddRetentionPolicyAllowedTables(ForceUpdate: Boolean)
@@ -47,59 +46,21 @@ codeunit 1596 "Email Installer"
4746

4847
RetenPolAllowedTables.AddAllowedTable(Database::"Email Outbox", Field.FieldNo(SystemCreatedAt), 7);
4948
RetenPolAllowedTables.AddAllowedTable(Database::"Sent Email", Field.FieldNo(SystemCreatedAt), 7);
49+
RetenPolAllowedTables.AddAllowedTable(Database::"Email Inbox", Field.FieldNo(SystemCreatedAt), 2);
5050

5151
if IsInitialSetup then
5252
UpgradeTag.SetUpgradeTag(GetEmailTablesAddedToAllowedListUpgradeTag());
5353
end;
5454

55-
procedure CreateRetentionPolicySetup(ForceUpdate: Boolean)
56-
var
57-
Field: Record Field;
58-
RetentionPolicySetup: Record "Retention Policy Setup";
59-
RetenPolAllowedTables: Codeunit "Reten. Pol. Allowed Tables";
60-
RetentionPolicySetupCU: Codeunit "Retention Policy Setup";
61-
UpgradeTag: Codeunit "Upgrade Tag";
62-
DateFormula: DateFormula;
63-
IsInitialSetup: Boolean;
64-
begin
65-
IsInitialSetup := not UpgradeTag.HasUpgradeTag(GetEmailInboxPolicyAddedToAllowedListUpgradeTag());
66-
if not (IsInitialSetup or ForceUpdate) then
67-
exit;
68-
69-
if not RetenPolAllowedTables.AddAllowedTable(Database::"Email Inbox", Field.FieldNo(SystemCreatedAt), 2) then
70-
exit;
71-
72-
RetentionPolicySetup.SetRange("Table Id", Database::"Email Inbox");
73-
if not RetentionPolicySetup.IsEmpty() then
74-
exit;
75-
76-
Evaluate(DateFormula, '<-2D>');
77-
78-
RetentionPolicySetup.Validate("Table Id", Database::"Email Inbox");
79-
RetentionPolicySetup.Validate("Apply to all records", true);
80-
RetentionPolicySetup.Validate("Retention Period", RetentionPolicySetupCU.FindOrCreateRetentionPeriod('2 DAYS', "Retention Period Enum"::"Custom", DateFormula));
81-
RetentionPolicySetup.Validate(Enabled, true);
82-
RetentionPolicySetup.Insert(true);
83-
84-
if IsInitialSetup then
85-
UpgradeTag.SetUpgradeTag(GetEmailInboxPolicyAddedToAllowedListUpgradeTag());
86-
end;
87-
8855
local procedure GetEmailTablesAddedToAllowedListUpgradeTag(): Code[250]
8956
begin
9057
exit('MS-373161-EmailLogEntryAdded-20201005');
9158
end;
9259

93-
local procedure GetEmailInboxPolicyAddedToAllowedListUpgradeTag(): Code[250]
94-
begin
95-
exit('MS-539754-EmailInboxPolicyAdded-20240827');
96-
end;
97-
9860
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Reten. Pol. Allowed Tables", OnRefreshAllowedTables, '', false, false)]
9961
local procedure AddAllowedTablesOnRefreshAllowedTables()
10062
begin
10163
AddRetentionPolicyAllowedTables(true);
102-
CreateRetentionPolicySetup(true);
10364
end;
10465

10566
[EventSubscriber(ObjectType::Codeunit, Codeunit::"System Initialization", OnAfterLogin, '', false, false)]

0 commit comments

Comments
 (0)