How to Hide the Entry Layout Sections
This guide explains how to hide a section in an entry layout using a custom script. You can hide sections unconditionally or based on specific conditions (for example, field values).
Watch the guided demo below to hide the section.
You can also follow the same steps using the written guide below.
Hide a Section
Step 1. Get the Section (Item) ID
Before writing the script, you need the section (item) ID.
- Open the record and select the three-dot menu > Configure Record.
- Click Entry Layouts.
- Select the layout you want to modify.
- Click the element you want to hide.
- Copy the Item ID from the Inspect tab.
Step 2. Add the Script
- Go back to the record configuration.
- Click Interactions from the side navigation.
- Set up the new Interaction configuration:
- Enter the Interaction name and description.
- Specify where the Interaction applies.
- Select the event when it will be executed.
- Choose the run mode.
- In the Handler code block, create a script using the
[setElementHidden](https://knowledge.clevero.co/reference/list-of-utility-functions#setelementhidden)function:
async function handler(C){
return C.setElementHidden("<Insert Item ID here>", true);
}- Replace
<Insert Item ID here>with the ID you copied earlier. - Save your changes.
Step 3. Test the Interaction
- Open a record.
- Click Edit on the entry.
- If the script is correct, the selected section should no longer appear in the layout.
Hide a Section with Conditions
Step 1. Add Conditional Logic
You can hide sections dynamically based on field values. For example, hide a section when the Participant field is filled.
async function handler(C) {
const v = C.getValue("PARTICIPANT_FIELD_ID");
let value = Array.isArray(v) ? v[0] : v;
if (value != null && typeof value === "object") {
value = value.internalId ?? value.id ?? value.value;
}
// Hide the section when the Participant field has a value
const hideSection = value != null && value !== "";
return C.setElementHidden("ITEM_ID", hideSection);
}How this works:
C.getValue("PARTICIPANT_FIELD_ID")retrieves the value of the Participant field.- The script then handles the value (arrays and objects).
- The section is hidden when the field has a value (i.e., not empty or null).
Step 2. Verify Conditional Behavior
- Open a record in Edit mode.
- Leave the Participant field empty → the section should remain visible.
- Fill in the Participant field → the section should be hidden.
📌 Need Help?
Updated about 1 hour ago
