Requirement Overview
A Zoho CRM user wants to Hide certain layout sections only on specific pages — like Create, Edit, Clone, or Detail Pages— to simplify the UI and improve the user experience.
Use-case
-> A User has a Finance Related Business(i.e. A Bank or Insurance Company). Company deal with Customer personal information, financial transactions, bank account details, confidential tax information, etc. and these information are stored in each Sections.
-> Usually, user will only fill Customer's information while creating a record and other information will be filled with further follow-ups. Hence, other unwanted sections(i.e. financial transactions, bank account detail, etc.) needs to be hidden in Create Page alone.
Current Challenges to achieve this directly
As of now, we do not have a permission-based controls to Show/Hide sections in Specific Pages. While the Layout Rules feature can be used to hide sections, it applies globally across all pages, which makes it unsuitable for this particular requirement.
Permissions & Availability
-> Users with the Modules Customization permission can add field into module layout & manage Layout rule.
-> Users with the Developer Permission can configure & setup Client Script.
-> Users with the Manage Sandbox permission can manage the sandbox.
Solution - Step-by-Step Implementation Guide
-> To fulfill this requirement and enhance the user interface, we will utilize multiple built-in features in Zoho CRM—such as Layout Rules, Client Scripts, and Workflow Rules—to hide specific sections on designated pages.
Hide Sections in CREATE/EDIT/CLONE Page
To hide sections in Create/Edit/Clone page, we will have to use below technical components.
Technical Components
- Layout Rule
- Client Script
- Workflow Rule (for Detail view page to show section)
STEP1 - Checkbox field in layout to control section visibility
Add a Checkbox field(named - Show Section) in required module layout(i.e. Lead, Contact, etc.).
If you do not want your users to see the custom field, then you can mark it as hidden(i.e. Don't Show) for all profiles in Field Edit Properties.
STEP2 - Create a Layout Rule
Navigate to Setup (⚙️) in Zoho CRM >> Customization >> Kiosk studio >> Create Kiosk.
Create a Layout Rule for the required module to show/hide section based on above added checkbox field.
STEP3 - Create a Client Script
Navigate to Setup (⚙️) in Zoho CRM >> Developer Hub >> Client Script >> New Script.
Add script for "Create Page --> select required Module & Layout -> Event Type as Page Event -> Event as onLoad"
Using Client Script, we will set the added Checkbox field as "Read Only" and update field as "Not Selected" on Load of Create Page. So that, it would hide the section in Create Page alone.
SAMPLE CLIENT SCRIPT
- // //Getting Field
- var hideShowVar = ZDK.Page.getField('Show_Section');
- console.log("hideeee", hideShowVar);
- // //Updating checkbox field as Selected
- hideShowVar.setValue(false);
- // //Making field as Read Only by default
- hideShowVar.setReadOnly(true);
Now, when user saves a record(from Create Page), it would redirect to Detail Page where section should be visible. To control this, we will use Workflow Rule additionally to update the Checkbox field as "Not Selected", so that it would show the section in Detail Page.
STEP4 - Create a Workflow Rule
Navigate to Setup (⚙️) in Zoho CRM >> Automation >> Workflow.
Add a workflow for required module and set "Trigger as Created/Editor with Repeat enabled -> No Condition -> Action as Field update".
Workflow Rule required only when you want to show/hide sections specifically on Create/Edit/Clone pages alone.
Overall Configuration Demo - Screencast
Overall Working Demo - Screencast
Hide Sections in Detail Page - Standard View
To hide sections in Detail page, we will have to use below technical components.
STEP1 - Add two checkbox fields in layout to control section visibility & Reload
-> Add a Checkbox field(named - Show Section) in required module layout(i.e. Lead, Contact, etc.).
-> Add an other Checkbox field(named - ForDetailPage - stop automatic reload) in same layout to control automatic refresh of Detail page.
If you do not want your users to see the custom field, then you can mark it as hidden(i.e. Don't Show) for all profiles in Field Edit Properties.
STEP2 - Create a Layout Rule
Navigate to Setup (⚙️) in Zoho CRM >> Customization >> Kiosk studio >> Create Kiosk.
Create a Layout Rule for the required module to show/hide section based on above added checkbox field.
STEP3 - Create a Client Script
Navigate to Setup (⚙️) in Zoho CRM >> Developer Hub >> Client Script >> New Script.
Add script for "Detail Page --> select required Module & Layout -> Event Type as Page Event -> Event as onLoad"
Using Client Script, we will set the added Checkbox field(Show Section) as "Read Only" and update field as "Not Selected" on Load of Detail Page. So that, it would hide the section in Create Page alone.
Note : Currently, any updates made to the Detail Page through Client Script do not reflect immediately; the user must reload the page to see the changes applied to the record.
Due to above limitation, we will automatically refresh the record Detail page using same Client Script so that whenever user opens a record Detail Page, script would update the record and make an automatic reload. However, we will have to stop reload after once. Hence, we are using an other Checkbox field to stop reload.
For Example:
Whenever a user opens a record, Client Script would trigger and update both Checkbox fields as below. Based on Checkbox2 value(if not selected), we will reload page. By this way, we will control reload of page only at once.
Checkbox1 : Show Section ---> as "Not Selected"
Checkbox2 : ForDetailPage - stop automatic reload ---> as "Selected"
SAMPLE CLIENT SCRIPT:
- // Fetching current record
- var recDetail = ZDK.Apps.CRM.Testss.fetchById($Page.record_id);
- // console.log(recDetail);
- recDetail.Show_Section = false;
- recDetail.ForDetailPage_stop_automatic_reload = true;
- var recUpdate = recDetail.__update();
- console.log("recUpdate",recUpdate);
- var stopField = ZDK.Page.getField('ForDetailPage_stop_automatic_reload');
- // //Making field as Read Only by default
- stopField.setReadOnly(true);
- var stopFieldVal = stopField.getValue();
- console.log(stopFieldVal);
- console.log("field value");
- if (stopFieldVal == false) {
//to refresh the Detail Page automatically after update for one time.
- console.log("entered");
- ZDK.Client.navigateTo('record_detail', { module: 'testss', record_id: $Page.record_id });
- }
Working Demo for Detail Page - Screencast
To ensure a smooth implementation, we recommend configuring and testing the setup in the
sandbox environment before deploying it to production.
Above Use-Case would also help in such scenario where Business want to show specific section based on User's Profile. Using Client Script, you could fetch logged in user details using $Crm.user method (
Help_Reference ) and then perform above actions to hide section.
Roadmap
We do have plans to support Show/Hide Sections using Client Script directly in future, enabling users to dynamically control section visibility on required pages based on business requirements.