Control Which Values Are Available in Property Rule Conditions
As the factory application developer, you can control which groups and individual values users can select when defining conditions in the Page, Flow, and Fragment Properties editors. Use the @dt.metadataRuleOptions.conditions metadata to hide a group or an individual value, or to expose selected values within a hidden group.
For example, you can hide the Constants group and expose just one constant. This lets you specify the constants users need without listing every other constant to hide.
Before you begin, make sure property rules are enabled for the page, flow, or fragment in the factory extension, and identify the constants you want to expose. Configure this metadata in the factory property rules file; metadata added only in a customer extension does not control the condition picker. The following example assumes that the artifact already defines a constant named someConstant. Replace this sample name with the name of a constant in your application.
To configure the available condition values:
- In Advanced mode, open the property rules JSON file for the page, flow, or fragment in the factory extension. For a page, this is the
page-rules.jsonfile. -
Add
metadataRuleOptions.conditionsto the top-level@dtobject. If these objects already exist, merge the entries into them, preserving the other metadata.For example, use the following configuration to expose only
someConstantwithin the Constants group:{ "@dt": { "metadataRuleOptions": { "conditions": { "$constants": "off", "$constants.someConstant": "on" } } } }Each key identifies a group or an individual value in the condition editor. Use “
off” to hide it and “on” to expose it. Children inherit their parent’s setting unless a more specific path overrides it. If you omit the condition visibility metadata, the condition builder keeps its default behavior.In this example, all constants inherit “
off” from$constants, and$constants.someConstantoverrides that setting with “on”. The Constants group remains visible because it contains a visible child. Within that group, onlysomeConstantis exposed. - Open the corresponding property rules editor for an extension of the factory artifact and edit a rule’s condition. Check that the Constants group offers only the constant you enabled.
For instructions on creating property rules, see Set Property Values Using Rules.