Create Feature Parameters for Your Second-Generation Managed Package
To create a feature parameter for a 2GP managed package, create an individual XML file. Here are details on the file naming convention, folder structure, and the attributes you use when creating feature parameters.
Feature parameters for managed 1GP packages are created in the packaging org’s UI, see Create Feature Parameters in Your Packaging Org in the First-Generation Managed Packaging Developer Guide for details.
A package can include up to 200 feature parameters.
Feature parameters are stored as files in your Salesforce DX project folder.
Under the root force-app folder, create a folder and name it featureParameters. Store your feature parameter files in the feature parameters folder. Each feature parameter you create must have its own separate file.
It’s not possible to create feature parameters using a scratch org’s user interface.
The naming format for feature parameter files is <name>.featureParameter<type>-meta.xml.
The name is the API name of the feature parameter.
The type is the feature parameter type. Feature parameters can be booleans, integers, or dates.
| Type | File Name Format |
|---|---|
| Boolean | .featureParameterBoolean-meta.xml |
| Date | .featureParameterDate-meta.xml |
| Integer | .featureParameterInteger-meta.xml |
Feature parameters include these three fields.
| Field Name | Description |
|---|---|
| dataflowDirection | Indicates which direction this parameter is transferring data. Each feature parameter value gets transferred in one of two directions: from your LMO to a subscriber org (LmoToSubscriber), or from a subscriber org to your LMO (SubscriberToLmo). |
| masterLabel | The label of the feature parameter. This label displays in the app. |
| value | The value of the feature parameter. Booleans, integers, and dates are all valid values. Integer values can’t exceed nine digits. |
After a feature parameter is included and released in the package version, the data flow direction can’t be changed.
AdvancedPricingEnabled.featureParameterBoolean-meta.xml
NumberofLedgers.featureParameterInteger-meta.xml
ProjectActivationDate.featureParameterDate-meta.xml