Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
FeatureManagement Class
Namespace
Usage
The set methods (setPackageBooleanValue, setPackageDateValue, setPackageIntegerValue) use DML operations on setup sObjects. To learn more about mixing operations in a test, see Mixed DML Operations in Test Methods.
FeatureManagement Methods
The following are methods for FeatureManagement.
changeProtection(apiName, typeApiName, protection)
Signature
public static void changeProtection(String apiName, String typeApiName, String protection)
Parameters
- apiName: Type: String The API name of the custom object or custom permission to show or hide—for example, 'MyCustomObject__c' or 'MyCustomPermission'.
- typeApiName: Type: String The API name of the type that you want to show or hide: 'CustomObject' or 'CustomPermission'.
-
protection: Type: String
To show a custom object or custom permission, 'Unprotected'.
To hide a custom permission, 'Protected'.
Return Value
Type: void
Usage
1FeatureManagement.changeProtection('YourCustomPermissionName', 'CustomPermission',
2 'Protected');1FeatureManagement.changeProtection('YourCustomPermissionName', 'CustomPermission',
2 'Unprotected');1FeatureManagement.changeProtection('YourCustomObjectName__c', 'CustomObject',
2 'Unprotected');checkPackageBooleanValue(apiName)
Signature
public static Boolean checkPackageBooleanValue(String apiName)
Parameters
- apiName: Type: String The fullName__c value of the feature parameter whose value you want to check—for example, 'SpecialAccessAvailable'.
Return Value
Type: Boolean
The value that’s currently assigned to the value__c field on the FeatureParameterBoolean__c record that associates the feature parameter with its related license.
checkPackageDateValue(apiName)
Signature
public static Date checkPackageDateValue(String apiName)
Parameters
- apiName: Type: String The fullName__c value of the feature parameter whose value you want to check—for example, 'TrialExpirationDate'.
Return Value
Type: Date
The value that’s currently assigned to the value__c field on the FeatureParameterDate__c record that associates the feature parameter with its related license.
checkPackageIntegerValue(apiName)
Signature
public static Integer checkPackageIntegerValue(String apiName)
Parameters
- apiName: Type: String The fullName__c value of the feature parameter whose value you want to check—for example, 'NumberOfLicenses'.
Return Value
Type: Integer
The value that’s currently assigned to the value__c field on the FeatureParameterInteger__c record that associates the feature parameter with its related license.
checkPermission(apiName)
Signature
public static Boolean checkPermission(String apiName)
Parameters
- apiName: Type: String The API name of the custom permission to check the value of—for example, 'MyCustomPermission'.
setPackageBooleanValue(apiName, value)
Signature
public static void setPackageBooleanValue(String apiName, Boolean value)
Parameters
- apiName: Type: String The fullName__c value of the feature parameter whose value you want to set—for example, 'SpecialAccessAvailable'.
- value: Type: Boolean The value to assign to the value__c field on the FeatureParameterBoolean__c record that associates the feature parameter with its related license.
Return Value
Type: void
setPackageDateValue(apiName, value)
Signature
public static void setPackageDateValue(String apiName, Date value)
Parameters
Return Value
Type: void
setPackageIntegerValue(apiName, value)
Signature
public static void setPackageIntegerValue(String apiName, Integer value)
Parameters
Return Value
Type: void