Is there any way set feature parameters for package beta versions which did not pass security review?

Assuming you are going to release a new version of package which will include feature parameters. Before starting security review, you want to test how feature parameters would work on beta version of the package. However, you can't set feature parameter for beta version of package since it has not passed security review and the subscriber who installs this version, is not listed in the list of subscribers in LMA.


Does this mean that there is no native way to test feature parameters in pre-release version of package?

1 Answer 1


It is possible to use Dependency Injection to mock the Feature Parameters for development org or for beta packages.

Let's create Feature class and include this in the basic package

public with sharing class Feature {
    @namespaceAccessible public enum Display {Label, ApiName}
    @namespaceAccessible public interface DisplayProvider{
        Display getDisplay();
    @testVisible static DisplayProvider provider = new FeatureManagementProvider();
    public static DisplayProvider getProvider() {
        return Type.forName('MockFeatureProvider') != null ? (DisplayProvider) Type.forName('MockFeatureProvider').newInstance() : provider;
    public class FeatureManagementProvider implements DisplayProvider{
        public Display getDisplay() {
            return Display.values()[System.FeatureManagement.checkPackageIntegerValue('Display')];
    public static Display getDisplay() {
        return getProvider().getDisplay();

Create custom settings FeatureParameterMock__c with DateValue__c, BoolValue__c, IntegerValue__c.

Create custom setting record with Name having Display value and IntegerValue__c having desired value for Feature Parameter.

Create a class MockFeatureProvider and include this class and the custom settings into extension package with the same namespace and call this extension mock

@namespaceAccessible public with sharing class MockFeatureProvider implements Feature.DisplayProvider {
    public Feature.Display getDisplay() {
        return Feature.Display.values()[FeatureParameterMock__c.getAll()?.get('Display')?.IntegerValue__c];

Then install the Mock package extension and manipulate the data in custom setting record to change the value of Feature Parameter.

In the code where you need to check the value of the Feature Parameter, call Feature.getDisplay(), this method would return the mocked value from the custom settings for beta package or actual value on subscriber org where no mock is present.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.