Feature Parameters in Salesforce AppExchange Applications
Feature management, feature toggles, or feature flags are very popular terms in the software development world.
The ability to easily turn specific features on and off, set limits for certain customers, and monitor limit consumption can make your SaaS more successful.
Wouldn’t it be cool to charge a larger customer with greater app usage more than a customer with one or two users who are just using the app occasionally? Having separate limits/pricing might save you from losing the latter while charging the former appropriately.
In the Salesforce AppExchange world, this is possible thanks to the Feature Parameters.
Why is AppExchange Feature Management Useful?
I already mentioned the potential financial benefit you can gain, but that’s not all. Let’s summarize all the benefits in one place:
- Usage-based pricing – as stated above, by utilizing feature parameters, you can set different app limits for different customers and propose very different pricing. This will help you earn more from large customers with significant needs while retaining smaller clients with lesser requirements.
- Multiple app tiers – if you want to have different plans for the app, such as "Basic," "Premium," "Enterprise," etc., that vary by the functionalities they provide, you can enable/disable certain app features with feature parameters.
- Easier debugging – how about having the ability to turn on the app’s "debug mode" for a specific customer, effectively enabling some hidden debugging features? We did this in our ISV Analytics app, and troubleshooting is now much easier.
- Basic metrics collection – as you’ll see later in the article, there is one type of Salesforce feature parameter that allows you to track customer usage metrics, such as how many times certain logic was invoked. This is mostly useful for monitoring limit consumption.
Types of Feature Parameters
There are two categories of feature parameters that you can set up for your managed package:
- LMO-to-Subscriber – controlled by you from the level of your License Management Org. You set the values manually for each customer or stick with the defaults. If you want to specify different plan levels, app limits, or enable/disable certain features, use this type of feature parameter.
- Subscriber-to-LMO – controlled by your package’s Apex code. You decide which part of the code and when to update the parameter. Use this parameter type for collecting usage/activation metrics, monitoring limit consumption, or collecting customer preferences.
Note: Do not use feature parameters for comprehensive app usage analytics. You’d need to create many different Subscriber-to-LMO parameters, leading to maintenance overhead and poor results. There is a separate, powerful mechanism for that: AppExchange App Analytics.
How to Use Feature Parameters in Your Managed Package
To use Feature Parameters in your app, you’ll need to perform the following steps:
-
Install the Feature Management App (FMA) in your License Management Org (LMO).
This is an AppExchange package created by Salesforce to enable Feature Parameters management. You need to install it in your LMO, but it’s likely already installed there. If not, create a support case so the Salesforce team can install it for you. (If you have the FMA package link, you can use it instead of submitting the case.) -
Configure FMA.
This involves adding appropriate related lists to your License record page. Feature parameters are represented as records related tosfLma__License
records. Add the following related lists to the license record page:- Feature Parameter Booleans
- Feature Parameter Dates
- Feature Parameter Integers
I like to use dynamic related lists to separate LMO-to-Subscriber parameters from Subscriber-to-LMO parameters. This is how we have it configured on our LMO to manage ISV Analytics customer licenses:
-
Add feature parameter metadata to your package.
This step differs for 1GP (first-generation) and 2GP (second-generation) managed packages: -
Add Apex support:
-
For LMO-to-Subscriber parameters, add logic to your package to check its value and act accordingly. Use the
FeatureManagement
class. Example:Integer surveyRequestLimit = FeatureManagement.checkPackageIntegerValue('yourNamespace__LmoSubscriberParamName'); if(totalSurveyRequestsNumber > surveyRequestLimit) { SampleNotifier.notifyCustomer('Hold your horses! You already exceeded the survey requests limit!'); }
Note: You can’t update LMO-to-Subscriber parameters from your package’s code.
-
For Subscriber-to-LMO parameters, add logic to set their value. Again, use the
FeatureManagement
class. Example:Integer currentSurveyRequestsNumber = FeatureManagement.checkPackageIntegerValue('yourNamespace__SubscriberLmoParamName'); FeatureManagement.setPackageIntegerValue('yourNamespace__SubscriberLmoParamName', currentSurveyRequestsNumber + 1);
See all available methods in the FeatureManagement class documentation.
-
-
Release a new package version with your changes.
-
Modify the LMO-to-Subscriber parameter values in your License Management Org (LMO).
When someone installs your package, the corresponding license record appears in your LMO. Open this record and navigate to the related lists you created earlier. From here, you can check the current parameter values and edit the LMO-to-Subscriber ones.Note: Technically, you can edit Subscriber-to-LMO parameter values in your LMO (editing is disabled only by layout validation), but don’t do this. The value will not update in your subscriber’s org and may cause confusion.
AppExchange Feature Parameters Limitations
There are a few considerations you should keep in mind when planning your feature parameters:
- Max. number of feature parameters per package – 200 (many sources provide 25 as the limit, but this was increased in the Winter ’23 Release).
- Subscriber-to-LMO parameter sync delay – when your code updates the parameter on the subscriber’s org, you will wait up to 24 hours to see that change in your License Management Org. However, if you need to see the most current value (e.g., for testing), you can work around this by using the Subscriber Console. Open the license record and use the Log Into Subscriber Console action button. You’ll be taken to a page summarizing your customer’s org, including current feature parameter values.
- Supported data types – Both Subscriber-to-LMO and LMO-to-Subscriber parameters can only be defined as numbers, booleans, and dates. No text is allowed. If you were thinking about serializing a complex structure into JSON and passing it via a feature parameter, I have to disappoint you. 😛
Conclusion
Feature Parameters for managed packages are Salesforce’s answer to feature management in AppExchange apps. They enable you to improve your pricing strategy, customize app behavior for certain customers, collect client preferences, and track basic usage/activation metrics.
That’s all I have for you today 🙂 Let me know if it was helpful or if you have anything to add in the comments section.
If you need help with AppExchange app development, reach out to me directly (https://linkedin.com/in/bartosz-suchocki) or to anyone on our amazing team (https://linkedin.com/company/beyondtheclouddev).