Check if feature is enabled

 Features can be difficult to check if is enabled. Some have helper classes, some do not, some are even final and private, so how do you check if a feature is on.

Just by coincidence we got a custom hotfix, only code, related to a performance issue with Retail. In that code we got a way to check features.



 private boolean shouldUseRetailPricingDataManagerV3()

    {

        RetailPricingSharedParameters parameters = RetailPricingSharedParameters::find();

        FeatureManagementState state;

        FeatureManagementMetadata featureData;


        select firstonly IsEnabled, RecId from state

            join featureData

            where state.RecId == featureData.FeatureState

            && state.Name == 'Dynamics.AX.Application.RetailDiscountPerformanceImprovementFeature ';


        return (state.RecId == 0 ||state.IsEnabled == NoYes::Yes)

            && !Global::isFlightEnabled('RetailPricingStopFlattenDiscountFeatures ')

            && !parameters.ProcessingLookupTables;

    }


In this code it checks for two features in two ways, first it checks the feature Dynamics.AX.Application.RetailDiscountPerformanceImprovementFeature by table buffer. 

Then It checks the RetailPricingStopFlattenDiscountFeatures by calling Global method is FlightEnabled with the feature name as a parameter. 


Tablebrowser:

To view it type this in your address field: 

[your D365FO URL]/?mi=systablebrowser&tablename=FeatureManagementState.



Comments

Popular posts from this blog

Call a simple Logic app from X++

SysOperationFramework with use of Query

Retail Attributes on sales lines