Launched: Prerequisites for Flag Dependencies

LaunchDarkly prereqheader

To perform smarter, conditional feature releases, our customers have asked for the ability to control feature dependencies in LaunchDarkly. In other words, they wanted to evaluate Flag B only if Flag A was “on” for a particular user.

For example, let’s say we have a feature flag that controls the visibility of a checkout flow with multiple steps. Within that flow, we have additional feature flags that control smaller elements, like a button and a modal. We want to make sure that the checkout flow is actually “on” for a user before we evaluate the flags for buttons and modals.

To provide this functionality, we have launched Prerequisites (beta), which lets you add a list of flags and their expected values as prerequisites to enable a feature.

Prerequisite Example

Let’s say we have two flags that control an API: api_reads and api_writes. In this case, it makes no sense to have write access to the API if you do not have read access. With prerequisites, you can make sure that api_reads is “on” with the user receiving true before api_writes is evaluated for that user.

You can manage your prerequisites in the feature flag’s Targeting tab:

LaunchDarkly Feature Flag / Toggle Dependencies - Prerequisites

You can add as many prerequisites as you want to a feature flag. We have checks built in to ensure that there are no circular dependencies and that deleted flags are automatically removed as dependencies.

Example Use Case

Mutually exclusive experiments

Let’s say we want to test whether the size or color of a button affects user engagement, but we want to run these two experiments at the same time.  Prerequisites gives you the ability to compartmentalize experimentation , allowing you to run exclusive experiments without hardcoding the logic into your codebase.  In this case, we want to ensure that users who receive the button size experiment do not receive the color experiment.

First, we have a feature flag that shows a red button to 50% of users:

LaunchDarkly Feature Flag Rollout

Second, we have a feature flag that shows a big button to all users who are receiving false for the ‘Red Button’ flag:

LaunchDarkly Feature Flag Rollout - Prerequisite flag dependency

In other words, all users who receive true for the Red Button flag will receive false for the Big Button flag.   This means that no user will get Red and Big for their button style.

Here is some example code (Java):

However, what if you now want to test making the button both Red and Big ?  You can do that with LaunchDarkly by simply changing the prerequisite value to true:

LaunchDarkly Feature Flag / Toggle Prerequisites - Inclusive Experiment

No code changes are needed. The beauty of this example is that your experiments are completely decoupled from your codebase.

There are many exciting ways to use prerequisites, especially when you take full advantage of our multivariate feature flags and custom rules.  If you have any questions or feedback, please send them to and we’ll be happy to help!

As a designer who can code, Justin can empathize with a developer's workflow and design intuitive interfaces to address extremely complex functionality. He has built dozens of user interfaces for high-traffic applications — winning the Best of California IT Design award in 2012. He frequently contributes feature flag management and design theory articles to DZone,, and DesignerHub. He holds degrees from UC Davis and USC, and is finishing an MS in Information Design at Northwestern. When he's not making developer's lives easier, he enjoys tennis, computer games, and writing.