2

We are trying to use - Feature Parameters in one of the applications we are building. Got most of the info from https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/fma_manage_features.htm

Everything works fine, but how do I override the System.FeatureManagement.checkPackageBooleanValue in my developer org.

Because of the default value for the FeatureParameter most of Test cases are failing :( Any help is greatly appreciated.

1 Answer 1

3

In the demo project, they include instructions for how to set the values both for testing in real mode and in unit test mode. I suspect that the answer you're really looking for is to set the preferred flag in your unit test:

// enable the param so we can continue our testing
FeatureManagement.setPackageBooleanValue('ExpenseTrackingPermitted',true);

This method only works in unit tests in your namespace. There's also ways to test this in your org by deploying metadata by updating a file in the featureParameters folder in your project files. I suggest you check out the project for more information.

2
  • Thanks, it worked. I've to use System.runAs(user) { } after setting the FeatureParameter. In the developer org if I want to enable the same for manual testing, how do I do it?? apart from changing them in the package. Dec 10, 2018 at 7:17
  • @SuryaChandraRaoGandreddi You need to expose a method to use it, such as a Visualforce page or Apex class. See project-force/pf-app/main/default/classes/FeatureConsoleAPI.cls as in example in the demo repository from the answer.
    – sfdcfox
    Dec 10, 2018 at 7:23

You must log in to answer this question.

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