UTIL_FeatureFlag.INT_FeatureFlagStrategy
Class
global interface UTIL_FeatureFlag.INT_FeatureFlagStrategyKnown Derived Types: UTIL_FeatureFlag.INT_UserAwareFeatureFlagStrategy
The global interface for all feature evaluation strategies. Implement this interface and reference your class from FeatureFlagStrategy__mdt.CustomHandler__c to replace any built-in strategy. This is the recommended escape hatch when the built-in Hierarchical/List Custom Setting or Custom Metadata strategies cause SOQL hot spots: a custom handler can call typed MyCS__c.getInstance(userId) / MyType__mdt.getInstance(name) directly for zero-SOQL platform-cached reads. See the Utilities Guide → "Performance and SOQL Cost".
Since: 1.0
Example:
// Example implementation of a custom strategy
public class MY_Region_Strategy implements UTIL_FeatureFlag.INT_FeatureFlagStrategy
{
public Boolean isEnabled(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate)
{
// Custom logic to enable feature only for users in the 'US'
Boolean isFeatureEnabled = UserInfo.getCountry() == 'US';
return isFeatureEnabled;
}
}Methods
| Method | Description |
|---|---|
| global abstract Boolean isEnabled(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate) | Evaluates the strategy and determines if the feature should be enabled. |
Method Details
isEnabled
global abstract Boolean isEnabled(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate)Evaluates the strategy and determines if the feature should be enabled.
Parameters:
flag(FeatureFlag__mdt) - The Feature Flag custom metadata record.strategyToEvaluate(FeatureFlagStrategy__mdt) - The specific strategy record to evaluate.
Returns: Boolean - true if the feature is enabled by this strategy, false otherwise.
Since: 1.0
Example:
public Boolean isEnabled(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate)
{
// Check if the strategy's target value matches our condition
Boolean isTargetMet = strategyToEvaluate.TargetValue__c == 'Some_Value';
return isTargetMet;
}