MetadataSwitch - adobe-dmeservices/custom-metadata GitHub Wiki

Switch Fields

Switch Fields allow users to select one of two predefined values. You can configure the values in the Options tab. Switch Fields require two values, defined as an object. This must include an unchecked state value and a checked state value. In many cases, the unchecked state is defined as "". When the user enables the Switch, the checked value will be written to XMP.

In the example below, when a user enables the Switch, the value "True" will be written to XMP. When they disable the switch, the value "False" will be written to XMP.

{
	"checked": "True",
	"unchecked": "False"
}

In the next example, when a user enables the switch, the value "Red" will be written to XMP. When the user disables the switch, the value will be removed from XMP.

{
	"checked": "Red",
	"unchecked": ""
}

Know that the user must take action in order for a value to be written to XMP, so the disabled value (when defined) will not appear unless the user actively disables the switch. Additionally, the switch will turn red if the set value is not one of the two predefined values.

Note: Switches in Switch Groups behave differently, in that they do not have a value when unchecked.

Switch Groups

Switch Group Fields allow users to set the value of a property to one or more of several predefined values. Switch Groups store values in an unordered list, or bag. You can configure the values in the Options tab.

Switch Group Fields options are different from standalone Switches. Switch Group options must be defined as an array of objects containing a label and value property. The selected values will be written to XMP. In the example below, if a user chooses option "Two," then "2" will be written to XMP. If the user chooses options "Two" and "Three," then "2" and "3" will be added to the bag in XMP.

[
    { 
        "label": "One", 
        "value": "1" 
    },
    { 
        "label": "Two", 
        "value": "2" 
    },
    { 
        "label": "Three", 
        "value": "3" 
    },
]

Note: Switches in Switch Groups behave differently than standalone Switches, in that Switch Groups do not have a value when unchecked.

Dependencies

You can optionally use Dependencies to set one or more Fields that must have data before a user can enter data in this Field. This Field will be disabled until there is a value present in the Field you specify in Dependencies. Learn more about Dependencies

  • To configure, choose one or more Fields from the Dependencies dropdown in the Advanced tab. The dropdown will display all currently defined Fields, so you will need to define Fields before you can use them as Dependencies for other Fields.