Client Script Support in Quick Create

Client Script Support in Quick Create




Welcome to another post in the Kaizen Series!

In this post, we explore how Client Script support in the Quick Create form can be used to automate data entry. This solution addresses a common business scenario where Zylker Furniture sells sofas, wardrobes, and dining tables through online channels. After delivery, the sales representative uses Quick Create to schedule the installation. In this process, the sales representative only needs to select the preferred date and time, while all other details are automatically populated. This ensures data accuracy, reduces manual entry, and saves valuable time for the sales representatives.

The Client Script Support for Quick Create is one of the most upvoted feature requests in Zoho Community.

In this Kaizen post,



  1.  What is the Quick Create Form?
  2. Supported Client Script Events
  3. Use Case
  4. Solution
  5. Summary
  6. Related Links




1. What is the Quick Create Form?

The Quick Create form is a lightweight popup in Zoho CRM that allows users to create a new record on the fly, without navigating away from the page they are currently on. With Client Script support, Quick Create can be further enhanced to automate actions such as auto populating fields, validating data, and executing logic based on the record context. This enables a faster, more efficient, and context aware record creation experience.

2. Supported Client Script Events

The following are the events supported by Client Script for Quick Create Form.


Refer to the Client Script Events documentation for more details about the events.

 

3. Use Case

Zylker Furniture sells sofas, wardrobes, and dining tables through online channels. After delivery, the sales representative uses Quick Create to schedule the installation. In this process, the sales representative needs to select only the preferred date and time, while all other details are auto-filled ensuring data is auto populated accurately, reducing manual entry during installation scheduling and save time of sales representatives.

 

4. Solution

Here, the requirement is to trigger the script as soon as the Quick Create pop up loads, so, create a Client Script with onLoad Quick Create event. 

  1. Go to Setup > Developer Space > Client Script. Click +New Script.

  2. Specify the details to create a script and click Next.
  1. Enter the following script and click Save.
  1. / --------------------------------------------------
  2. // Fetch source fields from root context
  3. // --------------------------------------------------
  4. var sourceCustomerId     = $Client.rootContext.getField('Name');
  5. var sourceCustomerName   = $Client.rootContext.getField('Customer_Name');
  6. var sourceAddress        = $Client.rootContext.getField('Address');
  7. var sourceDeviceType     = $Client.rootContext.getField('Product');

  8. // --------------------------------------------------
  9. // Fetch destination fields from the current page
  10. // --------------------------------------------------
  11. var targetCustomerId     = ZDK.Page.getField('Customer_ID');
  12. var targetName           = ZDK.Page.getField('Name');
  13. var targetInstallAddress = ZDK.Page.getField('Installation_Address');
  14. var targetDeviceType     = ZDK.Page.getField('Furniture_Type');

  15. // --------------------------------------------------
  16. // Assign values with safety checks
  17. // --------------------------------------------------
  18. if (sourceCustomerId && targetCustomerId) {
  19.     targetCustomerId.setValue(sourceCustomerId.getValue());
  20. }

  21. if (sourceCustomerName && targetName) {
  22.     targetName.setValue(sourceCustomerName.getValue());
  23. }

  24. if (sourceAddress && targetInstallAddress) {
  25.     targetInstallAddress.setValue(sourceAddress.getValue());
  26. }

  27. if (sourceDeviceType && targetDeviceType) {
  28.     targetDeviceType.setValue(sourceDeviceType.getValue());
  29. }
  • In this code, getField() is used to fetch the Name, Customer_Name, Address, and Product fields from the current record context.

  • ZDK.Page.getField() is used to fetch the Customer_ID, Name, Installation_Address, and Furniture_Type fields from the Quick Create form.

  • Conditional checks are used to validate that both the source and corresponding target fields exist before assigning values.

  • getValue() is used to retrieve values from the source fields.