Feature toggle-oriented development is a powerful methodology used to manage the release of new features in software applications, including Salesforce. This approach involves the use of feature toggles (also known as feature flags) to turn features on or off without deploying new code. This enables teams to test new features in production with selected users before making them available to everyone. Now, let’s break down how this methodology can be beneficial in a Salesforce context, how to implement a custom solution using permission sets, and then compare it with using a specialized service like LaunchDarkly.
Benefits of Feature Toggle-Oriented Development in Salesforce
- Incremental Rollouts: Gradually expose new features to a subset of users. This is especially useful in Salesforce where changes can significantly impact business operations.
- Risk Mitigation: Quickly disable a feature if it causes issues, without rolling back an entire deployment.
- A/B Testing: Test different versions of a feature with different groups of users to collect feedback and make data-driven decisions.
- Continuous Deployment: Deploy code at any time, even if features aren’t ready to be released to all users, thus keeping the development and release cycles independent.
Implementing Feature Toggles in Salesforce Using Permission Sets
Salesforce doesn’t have a built-in feature toggle system, but you can create a custom solution using Permission Sets and Custom Permissions.
- Create Custom Permissions: Define a custom permission for each toggleable feature. Custom permissions can be used to check access programmatically in Apex code, Visualforce pages, and Lightning components.
- Permission Sets: Assign these custom permissions to specific permission sets.
- Control Access: Assign the permission sets to users or profiles who should have access to the new features.
- Check in Code: Before executing feature-specific logic, check if the current user has the required custom permission using
FeatureManagement.checkPermission('Custom_Permission_API_Name')
.
This home-brewed solution allows for a degree of flexibility and control over feature release processes within Salesforce. However, managing this manually can become complex as the number of features grows.
LaunchDarkly: A Specialized Solution
LaunchDarkly offers a more sophisticated and scalable approach to feature toggle management compared to a custom Salesforce solution. It’s a feature management platform that allows teams to control the whole feature lifecycle from concept to launch to sunsetting.
Benefits over Custom Solutions
- Scalability: Easily manage a large number of feature flags across multiple environments and services.
- Targeting: Advanced user targeting rules allow for more granular control over who sees what features, beyond what’s easily achievable with Salesforce permission sets.
- Experimentation: Built-in A/B testing capabilities for measuring impact and making data-driven decisions.
- Real-Time Updates: Change feature flag states in real-time without needing to deploy code changes.
- Centralized Dashboard: A single dashboard to manage features across all environments, making it easier to coordinate feature releases.
LaunchDarkly’s Full Feature Set
- Feature Flags: Create, manage, and retire feature flags that control feature access in your applications.
- Targeting Rules: Define rules to target specific users or groups with specific features, based on attributes like location, email, or custom-defined parameters.
- Percentage Rollouts: Gradually roll out features to a percentage of users to mitigate risk and gather feedback.
- Experimentation and A/B Testing: Run experiments to test feature impact, with detailed analytics to inform decision-making.
- Integrations: Seamless integration with a wide range of development, monitoring, and analytics tools.
- SDKs: Extensive support for different programming languages and frameworks, facilitating easy integration into any application, including custom Salesforce applications via Apex if needed.
- Flag Lifecycle Management: Tools for managing the end-to-end lifecycle of flags, ensuring they are retired when no longer needed.
While a custom solution using Salesforce permission sets might offer a basic level of feature management with minimal setup, LaunchDarkly provides a comprehensive set of tools designed specifically for feature management. Its advanced targeting, experimentation, and real-time update capabilities far exceed what’s practical with a custom Salesforce-based solution, making it a strong choice for teams looking to implement feature toggle-oriented development at scale.