cs-icon.svg

Add a Field Visibility Rule

Field Visibility Rules in Contentstack allow authorized users to dynamically show or hide fields within an entry based on predefined conditions, improving content management and user experience. By setting up rules, users can control when fields appear, streamline data entry, and reduce clutter.

This guide outlines the steps to create and configure these rules, including defining conditions, setting actions, and managing multiple rules effectively.

When creating or editing a content type, you can define field visibility rules based on specific conditions on the “Content Type Builder” page.

Note: Only users with permission to create or edit content types can configure the field visibility rules.

To set up field visibility rules, log in to your Contentstack account and perform the following steps:

  1. Go to your stack and click the "Content Models" icon in the left navigation panel.
  2. Click the title of a content type to open it. Alternatively, click the vertical ellipses in the Actions column next to the content type and select Edit.
  3. Click Field Visibility Rules at the top of the page.

    Field Visibility Rules UI
  4. In the resulting modal, click Create New Rule.
  5. Under RULE 1, configure the rule as follows:

    1. Select whether the rule should apply when All or Any of the specified conditions are met:

      • All: The action triggers only if every specified condition is met.
      • Any: The action triggers if at least one specified condition is met.
    2. Specify the conditions:

      • Select a Field from the dropdown. This is the operand to be evaluated.
      • Choose a Condition. This is an operator that defines the comparison.

        Additional Resource: Refer to the Operand Fields and Supported Operators document for more details.

      • Enter an expected Value that triggers the condition.

        Example Condition: If "Date" is Before "12-31-2024".

        • Operand Field: Date
        • Condition (operator): Before
        • Expected Value: 12-31-2024

        Tip: You can add more conditions to a rule by clicking + Add Condition or remove them by clicking the delete icon.

      Note: Refer to the Limitations of Field Visibility Rules document to know more about the validations on the operand field and target field.

      Setting up actions in Field Visibility Rules

      Tip: You can add multiple rules to a content type by clicking + Add Another Rule or remove a rule by clicking the Delete Rule option from the vertical ellipsis.

  6. Click Save to apply the rule(s).
  7. Click Save or Save and Close to apply changes to the content type.
Was this article helpful?
^