Build your own custom logic to show or hide a component or component variation. Create a custom logic expression by adding your conditions for component visibility.
Required Editions
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
| Applies to: LWR sites |
| User Permissions Needed | |
|---|---|
| To create an Experience Cloud site: | Create and Set Up Experiences AND View Setup and Configuration |
| To customize or publish an Experience Cloud site: |
|
You can create visibility rules for any component in Experience Builder from the Visibility tab. Before creating a custom logic expression, add and specify the conditions. When you add a condition, it’s numbered. Your first condition is numbered 1, the second is numbered 2, and so forth. Use these conditions to build your expression.
- From Experience Builder, select a component that appears on the canvas.
- From the Visibility tab, click + Add Visibility Rule.
- From the Component State dropdown, choose to show or hide the component.
-
To add a condition for the logic, click Add Condition. Choose values
for all the conditions that you add.
Add at least two conditions.
- From the When dropdown, select The Custom Logic Is Met.
-
In the Custom Logic field, enter your custom logic expression.
Consider these criteria when you build a custom logic expression: Include at least 2 conditions, use all the added conditions, and use only AND and OR operators.
- Save your work.
Consider a scenario where you add three conditions: 1, 2, and 3. Your custom logic expression
can be 1 AND 2 OR 3. In this case, your component or
variation would appear when the conditions 1 and 2 are met, or when only condition 3 is met.
Another scenario: Consider the logic ((1 OR 2) AND (2 OR
3)). In this example your component would appear when either condition 1 or 2 is met
AND condition 2 or 3 is met.