Newer Version Available
Hide Custom Objects and Custom Permissions in Your Subscribers’ Orgs
Occasionally, you want to include custom permissions or custom objects in a package but
not show them to your subscribers. For example, if you're piloting a feature for a few select
orgs, and want to hide custom permissions and custom objects related to the pilot feature.
To hide custom objects when creating your package, set the value of their Visibility field to Protected.
To hide custom permissions when creating your package, from Setup, enter Custom Permissions in the Quick Find box. Select . Enable Protected Component, and then click Save. After your package is installed, use the System.FeatureManagement.changeProtection() Apex method to hide and unhide custom objects and permissions.
To hide custom permissions in released packages:
- System.FeatureManagement.changeProtection('YourCustomPermissionName', 'CustomPermission', 'Protected');
To unhide custom permissions and custom objects in released packages:
- System.FeatureManagement.changeProtection('YourCustomPermissionName', 'CustomPermission', 'Unprotected');
- System.FeatureManagement.changeProtection('YourCustomObjectName__c', 'CustomObject', 'Unprotected');