Codeunit "Retention Policy Setup"
This codeunit contains helper methods for retention policy setups.
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
SetTableFilterView
Use this procedure to open a Filter Page Builder page and store the resulting filter in view format on the retention policy setup line.
procedure SetTableFilterView(var RetentionPolicySetupLine: Record "Retention Policy Setup Line"): Text[2048]
Parameters
| Name | Type | Description |
|---|---|---|
| RetentionPolicySetupLine | Table System.DataAdministration."Retention Policy Setup Line" |
The record where the filter is stored. |
Returns
| Type | Description |
|---|---|
| Text[2048] |
The filter in Text format. |
GetTableFilterView
Use this procedure to get the filter that is stored in a view format on the retention policy setup line.
procedure GetTableFilterView(RetentionPolicySetupLine: Record "Retention Policy Setup Line"): Text
Parameters
| Name | Type | Description |
|---|---|---|
| RetentionPolicySetupLine | Table System.DataAdministration."Retention Policy Setup Line" |
The record where the filter is stored. |
Returns
| Type | Description |
|---|---|
| Text |
The filter in View format. |
GetTableFilterText
Use this procedure to get the filter that is stored in a text format on the retention policy setup line.
procedure GetTableFilterText(RetentionPolicySetupLine: Record "Retention Policy Setup Line"): Text[2048]
Parameters
| Name | Type | Description |
|---|---|---|
| RetentionPolicySetupLine | Table System.DataAdministration."Retention Policy Setup Line" |
The record where the filter is stored. |
Returns
| Type | Description |
|---|---|
| Text[2048] |
The Filter in text format. |
TableIdLookup
Use this procedure to open a lookup page to select one of the allowed Table Id's.
procedure TableIdLookup(TableId: Integer): Integer
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The currently stored Table ID. This value will be selected when you open the lookup. |
Returns
| Type | Description |
|---|---|
| Integer |
The new selected table id. |
DateFieldNoLookup
Use this procedure to open a lookup page to select one of the date or datetime fields for the given table.
procedure DateFieldNoLookup(TableId: Integer, FieldNo: Integer): Integer
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The table ID for which you want to select a field number. |
| FieldNo | Integer |
The currently selected field number. |
Returns
| Type | Description |
|---|---|
| Integer |
The new selected field number. |
IsRetentionPolicyEnabled
This procedure checks whether any retention policies are enabled.
procedure IsRetentionPolicyEnabled(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if a retention policy is enabled. False if no retention policies are enabled. |
IsRetentionPolicyEnabled
This procedure checks whether a retention policy is enabled for the given table ID.
procedure IsRetentionPolicyEnabled(TableId: Integer): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TableId | Integer |
The ID of the table that will be checked for an enabled retention policy. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if a retention policy is enabled for the table ID. False if no retention policy is enabled for the table ID. |
FindOrCreateRetentionPeriod
Finds or creates a new retention period record for the provided retention period.
procedure FindOrCreateRetentionPeriod(RetentionPeriodEnum: Enum "Retention Period Enum"): Code[20]
Parameters
| Name | Type | Description |
|---|---|---|
| RetentionPeriodEnum | Enum System.DataAdministration."Retention Period Enum" |
Specifies the retention period enum value for which the retention period record should be found or created. |
Returns
| Type | Description |
|---|---|
| Code[20] |
The retention period code for the retention period record. |
FindOrCreateRetentionPeriod
Finds or creates a new retention period record for the provided retention period.
procedure FindOrCreateRetentionPeriod(RetentionPeriodEnum: Enum "Retention Period Enum", RetPeriodCalc: DateFormula): Code[20]
Parameters
| Name | Type | Description |
|---|---|---|
| RetentionPeriodEnum | Enum System.DataAdministration."Retention Period Enum" |
Specifies the retention period length enum value for which the retention period record should be found or created. |
| RetPeriodCalc | DateFormula |
Specifies the retention period length date formula for which the retention period record should be found or created. |
Returns
| Type | Description |
|---|---|
| Code[20] |
The retention period code for the retention period record. |
FindOrCreateRetentionPeriod
Finds or creates a new retention period record for the provided retention period.
procedure FindOrCreateRetentionPeriod(RetentionPeriodCode: Code[20], RetentionPeriodEnum: Enum "Retention Period Enum", RetPeriodCalc: DateFormula): Code[20]
Parameters
| Name | Type | Description |
|---|---|---|
| RetentionPeriodCode | Code[20] | |
| RetentionPeriodEnum | Enum System.DataAdministration."Retention Period Enum" |
Specifies the retention period length enum value for which the retention period record should be found or created. |
| RetPeriodCalc | DateFormula |
Specifies the retention period length date formula for which the retention period record should be found or created. |
Returns
| Type | Description |
|---|---|
| Code[20] |
The retention period code for the retention period record. |