KVSCOREFeature#
Summary: Feature Management module. Use this module to manage changing processes and to control whether the old way should still be used or the new one. If the old process flow has been removed from the product, the feature can be hidden or removed.
Procedures#
Get(Code[20]) : Codeunit#
Summary: Retrieves a feature based on the provided code. This results in a runtime error if the feature does not exist.
procedure Get(Code: Code[20]): Codeunit
Parameters:
Code
: The code of the feature to retrieve.
Returns: Returns the current instance of the KVSCOREFeature codeunit.
Example:
Feature := Feature.Get(FeatureCodeTok)
Exists(Code[20]) : Boolean#
Summary: Checks if a feature with the specified code exists.
procedure Exists(Code: Code[20]): Boolean
Parameters:
Code
: The code of the feature to check for existence.
Returns: Returns true if the feature exists; otherwise, false.
Example:
if Feature.Exists(FeatureCode) then
// Do Something
IsEnabled() : Boolean#
Summary: Determines whether the feature is enabled.
procedure IsEnabled(): Boolean
Returns: True if the feature is enabled; otherwise, false.
Example:
if Feature.Get(FeatureCodeTok).IsEnabled() then
// Do Something
Add(Code[20], Text[10], Boolean, Boolean) : Codeunit#
Summary: Adds a new feature to the feature management system. if a new feature is added, OnGetName and OnGetDescription events should be subscribed to provide the displayname and description of the feature.
procedure Add(Code: Code[20]; MandatoryByVersion: Text[10]; Enabled: Boolean; IsOneWay: Boolean): Codeunit
Parameters:
Code
: The unique code identifier for the feature.Name
: The name of the feature.Description
: A detailed description of the feature. Limited to 2gb. Supports rich text.MandatoryByVersion
: The version by which the feature becomes mandatory. Must be in format "xx.x" (Regex: \d{2}.\d)Enabled
: Indicates whether the feature is enabled. Attention: if the feature is initialized as enabled, no feature activation is called initiallyIsOneWay
: Indicates whether the feature is a one-way feature (cannot be disabled once enabled).
Returns: Returns the KVSCOREFeature codeunit.
Example:
Feature.Add(FeatureCodeTok, FeatureNameTxt, FeatureDescriptionTxt, '25.3', false, false);
Add(Code[20], Version, Boolean, Boolean) : Codeunit#
Summary: Adds a new feature to the feature management system. if a new feature is added, OnGetName and OnGetDescription events should be subscribed to provide the displayname and description of the feature.
procedure Add(Code: Code[20]; MandatoryByVersion: Version; Enabled: Boolean; IsOneWay: Boolean): Codeunit
Parameters:
Code
: The unique code identifier for the feature.Name
: The name of the feature.Description
: A detailed description of the feature. Limited to 2gb. Supports rich text.MandatoryByVersion
: The version by which the feature becomes mandatory.Enabled
: Indicates whether the feature is enabled. Attention: if the feature is initialized as enabled, no feature activation is called initiallyIsOneWay
: Indicates whether the feature is a one-way feature (cannot be disabled once enabled).
Returns: Returns the KVSCOREFeature codeunit.
Example:
Feature.Add(FeatureCodeTok, FeatureNameTxt, FeatureDescriptionTxt, '25.3', false, false);
Remove() :#
Summary: Removes the specified feature.
procedure Remove():
Example:
if Feature.Exists(FeatureCode) then
Feature.Get(FeatureCodeTok).Remove();
Remarks: This procedure handles the removal of a feature from the system. Ensure that the feature exists before calling this procedure.
Enable() : Codeunit#
Summary: Enables the feature.
procedure Enable(): Codeunit
Returns: An instance of the KVSCOREFeature codeunit.
Example:
trigger OnUpgradePerCompany()
begin
Feature.Get(FeatureCodeTok).Enable();
end;
Disable() : Codeunit#
Summary: Disables the feature.
procedure Disable(): Codeunit
Returns: An instance of the KVSCOREFeature codeunit.
Example:
Feature.Get(FeatureCodeTok).Disable();
Finalize() : Codeunit#
Summary: Finalizes the feature management process. This means that the feature will be activated if not already done and set to one way so that it cannot be deactivated again
procedure Finalize(): Codeunit
Returns: Returns An instance of the KVSCOREFeature codeunit.
Example:
trigger OnUpgradePerCompany()
begin
Feature.Get(FeatureCodeTok).Finalize();
end;
Hide() : Codeunit#
Summary: Hides the feature. Hidden features are no longer displayed in feature management, but it is still possible to query whether the feature is active. Before a feature is removed, it should first be hidden for a while to give dependent apps a little more time to take the necessary steps. Please note: once a feature has been hidden, it can only be made visible again by creating it again.
procedure Hide(): Codeunit
Returns: An instance of the KVSCOREFeature codeunit.
Example:
trigger OnUpgradePerCompany()
begin
Feature.Get(FeatureCodeTok).Hide();
end;
Events#
OnEnableFeature(Code[20]) :#
Summary: Event handler for enabling a feature.
[IntegrationEvent(false, false)]
local procedure OnEnableFeature(Code: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSCOREFeature", 'OnEnableFeature', '', false, false)]
local procedure DoSomethingOnEnableFeature(Code: Code[20])
begin
end;
Parameters:
Code
: The code of the feature to be enabled.
Example:
[EventSubscriber(ObjectType::Codeunit, Codeunit::KVSCOREFeature, OnEnableFeature, '', false, false)]
local procedure EnableFeature(Code: Code[20])
begin
if Code <> FeatureCodeTok then
exit;
// Upgrade Data
end;
OnDisableFeature(Code[20]) :#
Summary: Event handler for disabling a feature.
[IntegrationEvent(false, false)]
local procedure OnDisableFeature(Code: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSCOREFeature", 'OnDisableFeature', '', false, false)]
local procedure DoSomethingOnDisableFeature(Code: Code[20])
begin
end;
Parameters:
Code
: The code of the feature to be enabled.
Example:
[EventSubscriber(ObjectType::Codeunit, Codeunit::KVSCOREFeature, OnDisableFeature, '', false, false)]
local procedure DisableFeature(Code: Code[20])
begin
if Code <> FeatureCodeTok then
exit;
// Revert Data
end;
OnGetName(Code[20], Text[100], Boolean) :#
Summary: Event handler for retrieving the name of a feature based on its code.
[IntegrationEvent(false, false)]
local procedure OnGetName(Code: Code[20]; var Result: Text[100]; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSCOREFeature", 'OnGetName', '', false, false)]
local procedure DoSomethingOnGetName(Code: Code[20]; var Result: Text[100]; var IsHandled: Boolean)
begin
end;
Parameters:
Code
: The code of the feature.Result
: The variable to store the resulting name of the feature.IsHandled
: Indicates whether the event has been handled.
OnGetDescription(Code[20], Text, Boolean) :#
Summary: Event handler for retrieving the description of a feature based on its code.
[IntegrationEvent(false, false)]
local procedure OnGetDescription(Code: Code[20]; var Result: Text; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSCOREFeature", 'OnGetDescription', '', false, false)]
local procedure DoSomethingOnGetDescription(Code: Code[20]; var Result: Text; var IsHandled: Boolean)
begin
end;
Parameters:
Code
: The code of the feature.Result
: The variable to store the resulting description of the feature.IsHandled
: Indicates whether the event has been handled.