Codeunit "Reten. Pol. Allowed Tables"
This codeunit is used to manage the list of allowed tables for which retention policies can be set up. Extensions can only approve the tables they create. Extensions cannot approve tables from other extensions.
Properties
| Name | Value |
|---|---|
| Access | Public |
| Permissions | tabledata Field = r, tabledata "Retention Policy Allowed Table" = r |
Methods
AddAllowedTable
Adds a table to the list of allowed tables.
procedure AddAllowedTable(TableId: Integer): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to add. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
AddAllowedTable
Adds a table to the list of allowed tables.
procedure AddAllowedTable(TableId: Integer, DefaultDateFieldNo: Integer): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to add. |
| DefaultDateFieldNo | Integer |
The number of the date or datetime field used as default to determine the age of records in the table. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
AddAllowedTable
Adds a table to the list of allowed tables.
procedure AddAllowedTable(TableId: Integer, DefaultDateFieldNo: Integer, MandatoryMinRetenDays: Integer): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to add. |
| DefaultDateFieldNo | Integer |
The number of the date or datetime field used as default to determine the age of records in the table. |
| MandatoryMinRetenDays | Integer |
The minimum number of days records must be kept in the table. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
AddAllowedTable
Adds a table to the list of allowed tables.
procedure AddAllowedTable(TableId: Integer, DefaultDateFieldNo: Integer, TableFilters: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to add. |
| DefaultDateFieldNo | Integer |
The number of the date or datetime field used as default to determine the age of records in the table. |
| TableFilters | JsonArray |
A JsonArray which contains the default table filters for the retention policy |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
AddAllowedTable
Adds a table to the list of allowed tables.
procedure AddAllowedTable(TableId: Integer, TableFilters: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to add. |
| TableFilters | JsonArray |
A JsonArray which contains the default table filters for the retention policy |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
AddAllowedTable
Adds a table to the list of allowed tables.
procedure AddAllowedTable(TableId: Integer, DefaultDateFieldNo: Integer, MandatoryMinRetenDays: Integer, RetenPolFiltering: Enum "Reten. Pol. Filtering", RetenPolDeleting: Enum "Reten. Pol. Deleting", TableFilters: JsonArray): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to add. |
| DefaultDateFieldNo | Integer |
The number of the date or datetime field used as default to determine the age of records in the table. |
| MandatoryMinRetenDays | Integer |
The minimum number of days records must be kept in the table. |
| RetenPolFiltering | Enum System.DataAdministration."Reten. Pol. Filtering" |
Determines the implementation used to filter records when applying retention polices. |
| RetenPolDeleting | Enum System.DataAdministration."Reten. Pol. Deleting" |
Determines the implementation used to delete records when applying retention polices. |
| TableFilters | JsonArray |
A JsonArray which contains the default table filters for the retention policy |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
AddTableFilterToJsonArray
This helper method is used to build an array of table filters which will be inserted automatically when creating a retention policy for the allowed table. You must first build up the array by calling this helper function and adding all relevant table filter information before passing the JsonArray to the AddAllowedTable method.
procedure AddTableFilterToJsonArray(var TableFilters: JsonArray, RetentionPeriodEnum: Enum "Retention Period Enum", DateFieldNo: Integer, Enabled: Boolean, Locked: Boolean, RecordRef: RecordRef)
Parameters
| Name | Type | Description |
|---|---|---|
| TableFilters | JsonArray |
The JsonArray to which the table filter information will be added. |
| RetentionPeriodEnum | Enum System.DataAdministration."Retention Period Enum" |
Identifies the retention period for the retention policy table filter. |
| DateFieldNo | Integer |
The number of the date or datetime field used as to determine the age of records in the table. |
| Enabled | Boolean |
Indicates whether the retention policy line will be enabled. |
| Locked | Boolean |
Indicates whether the retention policy line will be locked. If this parameter is true, the line will also be enabled. |
| RecordRef | RecordRef |
A record reference containing the filters to be added to the retention policy setup line. |
AddTableFilterToJsonArray
This helper method is used to build an array of table filters which will be inserted automatically when creating a retention policy for the allowed table. You must first build up the array by calling this helper function and adding all relevant table filter information before passing the JsonArray to the AddAllowedTable method.
procedure AddTableFilterToJsonArray(var TableFilters: JsonArray, RetPeriodCalc: DateFormula, DateFieldNo: Integer, Enabled: Boolean, Locked: Boolean, RecordRef: RecordRef)
Parameters
| Name | Type | Description |
|---|---|---|
| TableFilters | JsonArray |
The JsonArray to which the table filter information will be added. |
| RetPeriodCalc | DateFormula |
Identifies the retention period dateformula for the retention policy table filter. |
| DateFieldNo | Integer |
The number of the date or datetime field used as to determine the age of records in the table. |
| Enabled | Boolean |
Indicates whether the retention policy line will be enabled. |
| Locked | Boolean |
Indicates whether the retention policy line will be locked. If this parameter is true, the line will also be enabled. |
| RecordRef | RecordRef |
A record reference containing the filters to be added to the retention policy setup line. |
RemoveAllowedTable
Removes a table from the list of allowed tables.
procedure RemoveAllowedTable(TableId: Integer): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table to remove. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is not in the list of allowed tables. False if the table is in the list of allowed tables. |
IsAllowedTable
Checks whether a table exists in the list of allowed tables.
procedure IsAllowedTable(TableId: Integer): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID to check. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the table is in the list of allowed tables. False if the table is not in the list of allowed tables. |
GetAllowedTables
Returns the allowed tables as a list.
procedure GetAllowedTables(var AllowedTables: List of [Integer])
Parameters
| Name | Type | Description |
|---|---|---|
| AllowedTables | List of [Integer] |
The allowed tables as a List. |
GetAllowedTables
Returns the allowed tables as a filter string.
procedure GetAllowedTables(): Text
Returns
| Type | Description |
|---|---|
| Text |
The allowed tables as a filter string. |
GetRetenPolFiltering
Returns the enum value set for retention policy filtering. This determines which code will handle the filtering of records when the retention policy for the allowed table is applied.
procedure GetRetenPolFiltering(TableId: Integer): Enum "Reten. Pol. Filtering"
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the allowed table. |
Returns
| Type | Description |
|---|---|
| Enum System.DataAdministration."Reten. Pol. Filtering" |
The retention policy filtering enum value. |
GetRetenPolDeleting
Returns the enum value set for retention policy deleting. This determines which code will handle the deleting of records when the retention policy for the allowed table is applied.
procedure GetRetenPolDeleting(TableId: Integer): Enum "Reten. Pol. Deleting"
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the allowed table. |
Returns
| Type | Description |
|---|---|
| Enum System.DataAdministration."Reten. Pol. Deleting" |
The retention policy deleting enum value. |
GetDefaultDateFieldNo
Returns the number of the date or datetime field in the list of allowed tables for the given table.
procedure GetDefaultDateFieldNo(TableId: Integer): Integer
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the allowed table. |
Returns
| Type | Description |
|---|---|
| Integer |
The field number of the date or datetime field in the allowed table. |
GetMandatoryMinimumRetentionDays
Returns the mandatory minimum number of retention days for the given table.
procedure GetMandatoryMinimumRetentionDays(TableId: Integer): Integer
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the allowed table. |
Returns
| Type | Description |
|---|---|
| Integer |
The mandatory minimum number of retention days for the allowed table. |
CalcMinimumExpirationDate
Calculates the minimum expiration date for a given allowed table based on the minimum number of retention days and today's date.
procedure CalcMinimumExpirationDate(TableId: Integer): Date
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID of the allowed table. |
Returns
| Type | Description |
|---|---|
| Date |
The minimum expiration date. |
Events
OnRefreshAllowedTables
This event is called when the user chooses to refresh the allowed tables.
[IntegrationEvent(False,False)]
internal procedure OnRefreshAllowedTables()