flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

Dependent flags

Open dabeeeenster opened this issue 2 years ago • 5 comments

Flags being dependent on other flags has been requested several times.

One option for this would be to allow flag booleans/values to be used as segment operator values. So for example, if you wanted Flag B to only be enabled if Flag A is enabled:

  • Create Flag A. Set as disabled.
  • Create Flag B. Set as disabled.
  • Create Segment. Single Rule: If Value of Flag A is set.
  • Set a segment override on Flag B: If Segment set, override Flag B value to true.

Cross-Project dependencies

We often get asked "Can we have a project with shared flags and a project with specific flags for e.g. iOS that combines both sets of flags". We could achieve this functionality with cross-project dependencies. Eg:

  • Create a shared project and a flag my_flag_1
  • Create an Android project
  • Create an iOS project
  • Create a flag in iOS and one in Android, my_flag_1 and make it dependent on the shared project flag.

We've talked about this here but maybe the above solution would be sufficient

dabeeeenster avatar Nov 18 '22 11:11 dabeeeenster

Will this function like a keystone flag? If Flag A is enabled I can also enabled Flag B-F?

landonjs avatar Sep 20 '23 13:09 landonjs

Will this function like a keystone flag? If Flag A is enabled I can also enabled Flag B-F?

Sorry I'm not clear what you mean here?

dabeeeenster avatar Sep 20 '23 16:09 dabeeeenster

From your example in the description will I be able to set the value of one flag based on another flag. Will I be able to set the value of multiple flags based on Flag A?

That would get me close to something like this: https://martinfowler.com/bliki/KeystoneInterface.html

landonjs avatar Sep 20 '23 17:09 landonjs

Yes that is what this would achieve.

dabeeeenster avatar Sep 21 '23 07:09 dabeeeenster

Related discussion on Stack Overflow here https://stackoverflow.com/questions/77011138/make-feature-flag-required-based-on-another-feature-flag-in-flagsmith/78060046?noredirect=1#comment137673786_78060046

dabeeeenster avatar Mar 05 '24 10:03 dabeeeenster