Skip to content

Retention Mgt. Pub (Retention Labels)

Document Central provides public functions to remove or set a Retention Label on a document. These functions are available in the codeunit "Retention Mgt. Pub" (ID: 5737062) in the namespace Simova.DMS.Feature.Compliance.RetentionLabel.

The following requirements must be met:

  • Document Central must be present in the extension as a reference.
  • The Compliance Feature is activated and Retention Labels are sucessfully setup

RemoveRetentionLabel

The RemoveRetentionLabel function removes a Retention Label from a document. The behavior depends on the repository type:

  • SharePoint: Removes the Retention Label both in Azure and on the Document Entry.
  • Azure Blob Storage: Only removes the Retention Label on the Document Entry.

Parameters

Var Name Data Type Subtype Length Description
Yes ParamRecordSIMDMSDocumentEntry Record "SIM_DMS Document Entry" The Document Entry record to remove the Retention Label from

Return Value

Data Type Description
Boolean True if the Retention Label was removed successfully, False if not. If an error occurs, an Error is thrown

Code Example

Show example code
AL
var
    LocalRecordSIMDMSDocumentEntry: Record "SIM_DMS Document Entry";
    LocalCodeunitRetentionMgtPub: Codeunit "Retention Mgt. Pub";
    LocalResult: Boolean;
begin
    // Get the Document Entry you want to remove the Retention Label from
    LocalRecordSIMDMSDocumentEntry.Get(...);

    LocalResult := LocalCodeunitRetentionMgtPub.RemoveRetentionLabel(LocalRecordSIMDMSDocumentEntry);
end;

SetRetentionLabel

The SetRetentionLabel function sets a Retention Label on a document. The behavior depends on the repository type:

  • SharePoint: Sets the Retention Label both in SharePoint and on the Document Entry.
  • Azure Blob Storage: Sets the Retention Label on the Document Entry and the Document Entry Version.

Parameters

Var Name Data Type Subtype Length Description
No ParamRecordSIMDMSUserSetup Record "SIM_DMS User Setup" The User Setup record for Authentication
Yes ParamRecordSIMDMSDocumentEntry Record "SIM_DMS Document Entry" The Document Entry record to set the Retention Label on
No ParamRetentionLabelText Text The name of the Retention Label to apply
Yes ParamRecordSIMDMSDocumentEntryVersion Record "SIM_DMS Document Entry Version" The Document Entry Version record (used for Azure Blob Storage)

Return Value

Data Type Description
Boolean True if the Retention Label was set successfully, False if not. If an error occurs, an Error is thrown

Code Example

Show example code
AL
var
    LocalRecordSIMDMSUserSetup: Record "SIM_DMS User Setup";
    LocalRecordSIMDMSDocumentEntry: Record "SIM_DMS Document Entry";
    LocalRecordSIMDMSDocumentEntryVersion: Record "SIM_DMS Document Entry Version";
    LocalCodeunitRetentionMgtPub: Codeunit "Retention Mgt. Pub";
    LocalResult: Boolean;
begin
    // Get the User Setup for Authentication
    LocalRecordSIMDMSUserSetup.Get(UserId());

    // Get the Document Entry you want to set the Retention Label on
    LocalRecordSIMDMSDocumentEntry.Get(...);

    // Get the Document Entry Version
    LocalRecordSIMDMSDocumentEntryVersion.Get(...);

    LocalResult := LocalCodeunitRetentionMgtPub.SetRetentionLabel(
        LocalRecordSIMDMSUserSetup,
        LocalRecordSIMDMSDocumentEntry,
        'Your Retention Label Name',
        LocalRecordSIMDMSDocumentEntryVersion
    );
end;