cs-icon.svg

Add a Field Visibility Rule

When you create or edit a content type, the Content Type Builder page opens up where you can set up field visibility rules that define the visibility of these fields based on the conditions that you enter.

Let’s see in detail how to set up field visibility rules for your content type.

Note: Only the users who have the right to create or edit content types can create field visibility rules.

  1. Add fields to your content type and save it before proceeding to add the field visibility rules.
  2. Click on the Field Visibility Rules button located at the top of the page.add-field-visibility-rule-ss1.png
  3. This opens the Field Visibility Rules modal. Click on the Create New Rule button.Add_Field_Visibility_Rules_1.png
  4. This is where you define the rules for your field. Under RULE 1, you will see two sections:
    • If {All | Any} of the following conditions are met:
    • Perform the following actions:
    These are the two parts of your rules, where you define “if” something happens (conditions), “do” this automatically (actions).add-field-visibility-rule-ss2.png
  5. Under the If {All | Any} of the following conditions are met section, you can define the event(s) that will trigger an action when the specified condition(s) is/are met. If you choose All, the event(s) will be triggered only if “all” the conditions that you specify are met. If you choose Any, the event will be triggered if “any” of the specified conditions are met.

    add-field-visibility-rule-ss3.png
  6. Defining a condition involves defining the “Operand field(s),” selecting the “Operator,” and mentioning the “Expected value.” Consider for example that your condition is “If Price is Greater than $200.” In this case, the “Price” field is the Operand field, “Greater than” is the Operator, and “$200” is the Expected value. Let’s look at the structure in detail:
    1. Select the field (such as Title, URL, Reference), on which you want to set the condition, as the Operand field. For our use case, we will select the "Price" field.
    2. There are certain limitations on what can and cannot be set as an operand field.
    3. Based on the field that you select as the operand field, you will see various operators in the next dropdown. See the list of operand fields and supported operators.
    4. Select an operator of your choice (such as Matches, Contains, Greater than, Is not, etc.). For our use case, we will select Greater than.
    5. In the last field, enter the expected value, such as 200 for our example.Add_Field_Visibility_Rules_2.png
    Once you define these three, you have successfully set a condition.

    Note: You can add multiple conditions in a rule by clicking + Add Condition. Before trying it out, we suggest you check out the Limitations of Field Visibility Rules for more details.

  7. Under the Perform the following actions section, you need to define the action / set of actions that need to be performed when the aforementioned conditions are met. For example, if the condition is “If Price is Greater than $200,” the action could be to display the “Free Shipping” checkbox field. In this case, the “Free Shipping” checkbox field is the target field, i.e., the field that needs to be displayed or hidden. Let’s learn how to add actions in a rule.
    1. You need to first select the type of action that you want to perform, i.e., Show or Hide. Depending on your selection, the rule will either show or hide the field on the entry page, if the specified condition(s) is/are met.Add_Field_Visibility_Rules_3.png
    2. Depending on what field(s) you want to show or hide, you can add one or more fields as the target fields. In the above example, the “Free Shipping” checkbox field is the target field.

      Tip: You can add multiple actions for a condition or a set of conditions by clicking + Add Action. For example, if the “Price” is greater than $200, Show the “Free Shipping” checkbox field and Hide the “Delivery Charges” field.

    With this, you have created a field visibility rule.
  8. You can add multiple rules for your content type by clicking on the + Add Another Rule button. Click the Save button to save the rule(s).
Was this article helpful?
^