Read time: 1 minute
Last edited: Feb 12, 2020
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.
For example, you have two flags that control read and write access to an API: "Alternate sort order" and "API Migration." If you do not have read access to the API, you cannot see it, so you cannot write to it. You can set up "Alternate sort order" as a prerequisite before "API Migration" is evaluated for a user by making sure "Alternate sort order" is On and the user is seeing the
Manage prerequisites in the feature flag's Targeting tab:
In the screenshot above, the "Alternate sort order" flag is a prerequisite of the "API Migration" flag. To meet a prerequisite, the prerequisite flag must be On, and the user must receive the variation you specify.
In this example, if a user receives the
false variation of the "Alternate sort order" flag, they will not be able to write to the API. The "API Migration" flag will not evaluate for them, because the prerequisites are not met.