Build an Expression-Based Visibility Rule in LWR Sites Using Custom Logic
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
Create and Set Up Experiences AND View Setup and Configuration
To customize or publish an Experience Cloud site:
Create and Set Up Experiences AND View Setup and Configuration AND be a member
of the site
OR
View Setup and Configuration AND be a member of the site AND have appropriate
role-based site access
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.
Example
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.
Did this article solve your issue?
Let us know so we can improve!
Loading
Salesforce Help | Article
Cookie Consent Manager
Cookie Consent Manager
General Information
Required Cookies
Functional Cookies
Advertising Cookies
General Information
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.