Skip to content

Instantly share code, notes, and snippets.

View AshikaSuresh's full-sized avatar

AshikaSuresh-ZohoCRM AshikaSuresh

View GitHub Profile
//How to add Color Coding to a field in Detail Page and List Page through Client Script.
//Color Coding a Field in Detail Page Canvas using Client Script
In Orders Module, once the product is added in the subform, those products will be updated in the Associated Account's Products Related List.
Demo video link : https://zwdrive.com/Up2Ptf
To achieve it through Client Script :
Create two events in Orders Module 1. Create Page - Page Event : onSave
2. Edit Page - Page Event : onSave
Enter the Below code
Disable Clone button :
The Clone button can be disabled for users other than those with an Admin profile using Client Script.
Configuration:
Page Details :
Category - Module
Page - Detail Page (Standard)
Module - Leads (Any module in which you would like to disable clone)
Layout - Standard
Disable 'Save' and 'Save and New' buttons :
The 'Save' and 'Save and New' buttons can be disabled in Clone Page for users other than those with an Admin profile using Client Script.
Configuration:
Page Details :
Category - Module
Page - Clone Page
Module - Leads (Any module in which you would like to disable clone)
Layout - Standard
Clearing Values in Fields of a Clone Page:
When a user attempts to clone a record and you want to prevent specific fields from being cloned, you can use a Client Script to clear those field values while the page is getting loaded.
Configuration:
Page Details :
Category - Module
Page - Clone Page
Module - Leads (Any module in which you would like to disable clone)
Layout - Standard
var products_list = ZDK.Page.getField('Product_list').getValue();
if (products_list.length === 1) { // Clear subform if empty row
!Object.values(products_list[0]).every(value => !!value) && products_list.pop();
}
// Open widget with product category & max. allowed rows based on existing subform data
var selected_products = ZDK.Client.openPopup({
api_name: 'choose_products', type: 'widget', header: 'Choose Products', animation_type: 1, height: '570px', width: '1359px', left: '150px'
}, {
Description:
In the Deals Module, after selecting the Account Name, when the Checkbox (Check out the products for this Account) is clicked, the Products from the Related List (RL) of the Associated Account will be retrieved and displayed in a Widget. The user can then choose one or more products and update them in the subform.
Configuration:
Page Details
Category Module
Page Create Page
Module Deals
Layout Standard
Case : Apply 10% discount on each item if total exceeds $500, based on user confirmation.
Configuration:
Page Details : Create Page - Quotes - Standard
Event Details : Page Event - onSave
Demo Video - https://zwdrive.com/d2cLQi
Whenever the user selects the "Product category", then the page should scroll to the respective section in the Create Page(Canvas).
Configuration
Page Details : Create Page (Canvas)- Orders
Event Details : Field Event - Product Category - onChange