Hello everyone!
Welcome back to another exciting Kaizen post on Client Script!
In this edition, we’re taking a closer look at Client Script Support for Subforms with the help of the following scenario.
" Zylker, a manufacturing company, uses the "Orders" module to place Orders . They fill in a subform called "Product List". Now, the Admin wants to enforce the following restrictions on this subform in detail page:
- Disable row deletion
- Prevent cloning and adding rows
- Make the "Unit Price" field read-only for salespersons "
In this post,
- What are Subform event
- Possible actions in Subform using Client Script
- Use Case
- Disable row deletion within the subform
- Prevent cloning and addition of rows in subform
- Make the "Unit Price" field read-only for salespersons
- Summary
- Related Links
1.What are Subform Events
Subform events are triggered by user actions, such as adding or deleting rows or updating data in subform. These events allow you to run Client scripts for validation, automation, or dynamic updates. Here is the list of subform events.
- onCellChange – Triggered when a cell value is changed and the keyboard or mouse focus moves out of the subform cell.
- onRowAdd – Fires immediately after a new row is added in a subform.
- onRowDelete – Executes right after a row is deleted from a subform.
- beforeRowDelete – Invoked before a subform row is deleted; can be used to prevent deletion.
- beforeRowUpdate – Triggered before a subform row is updated on Detail pages; useful for validations or preventing changes.
These events are supported in the following Pages of Zoho CRM
- Standard - Create/Edit/Clone Pages, Detail page
- Canvas - Create/Edit/Clone Pages, Detail page
- Wizard - Create/Edit Pages
2. Possible actions in Subform using Client Script
Click here to view the detailed documentation about the Client Script ZDKs related to Subform.

Note :
The
setValue() method for a subform row and cell on the Detail Pages will only work when the row is in edit mode.
3. Solution
To accomplish the solution for the use case (stated at the beginning of the post), you need to create the following Client Scripts in detail Page.
3.A. Disable row deletion within the subform
- Go to Setup > Developer Space > Client Script. Click +New Script.
- Specify the details to create a script.
- Click Next.