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.

  • It looks like that solution will only work if the need is anticipated during the development cycle and all code that uses feature management instead of accessing it directly, accesses it through a class. I don't suppose there's anyway to resolve the issue after the package is already built????
    – Ken
    Commented Feb 13, 2023 at 17:37
  • @Ken if package has been built and passed security review, there is no need to mock feature management but you can directly use feature management option
    – Patlatus
    Commented Feb 16, 2023 at 15:07
  • Interesting. is there something like this to mock Hiding and Unhiding Objects and Permissions? developer.salesforce.com/docs/atlas.en-us.pkg1_dev.meta/…
    – zurdo
    Commented Dec 12, 2023 at 23:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .