Read time: 1 minute
Last edited: Dec 15, 2021
This topic explains how to use feature flag prerequisites to enable or disable features based on different states.
Prerequisites allow you to control feature dependencies in LaunchDarkly. You can make flags depend on other flags being enabled to take effect themselves, making them prerequisites to enable a feature. To meet a prerequisite, the prerequisite flag must be On, and the user must receive the variation you specify.
You can manage prerequisites in the feature flag's Targeting tab:
In the example above, the "Pricing tier" flag is a prerequisite of the "Markdown List" flag. The "Markdown List" flag will not be evaluated for a user unless the "Pricing tier" flag is On and the user receives the
true variation. If a user receives the
false variation of the "Pricing tier" flag, LaunchDarkly does not consider the prerequisite met.
To meet a prerequisite, the prerequisite flag must be On. LaunchDarkly considers the prerequisite unfulfilled if the prerequisite flag is off, regardless of the value being served.
Flags can be dependent on multiple prerequisite flags. If a dependent flag has multiple prerequisite flags, then all of the prerequisite flag requirements must be met for LaunchDarkly to evaluate the dependent flag for a user.
LaunchDarkly automatically prevents you from saving changes that would introduce circular dependencies between prerequisites. For example, you cannot make Flag A a prerequisite of Flag B and also make Flag B a prerequisite of Flag A.
You cannot delete a flag that is a prerequisite for other flags. You must remove the dependency before you can delete the prerequisite flag.