Zoho CRM Skill

Zoho CRM Skill


Hello everyone!

Welcome back to another Kaizen post.

In this Kaizen, we’ll see how the Zoho CRM Skill solves a custom use case that requires multiple Zoho CRM developer tools. You describe the requirement in plain language, and the skill identifies the appropriate tools and generates the solution. We’ll walk through the case, see what the skill produced, and cover the points to review. 
Haven’t tried the Zoho CRM Skill yet? Start with the announcement and the introductory post to see how it can make your CRM development experience easier.

In this Kaizen post,

  1. Scenario: Limit-Based Discount Approval for Deals
  2. From Prompt to Code
  3. Which developer tool does what
  4. Implementation steps
  5. Test the flow
  6. Tips
  7. Summary
  8. Related links


1. Scenario: Limit-Based Discount Approval for Deals

At Zylker, Salespeople can offer a discount of up to 20% on a Deal without approval. Any discount above 20% must be approved by a manager.
The requirement is as follows:
  1. In the Deals module, when a Salesperson enters a discount of more than 20%, an error message should appear next to the Discount field stating that the discount should not be more than 20%.
  2. While saving the Deal, a dialog box should open asking the Salesperson to enter the reason for the additional discount and to select the approver’s name from a dropdown of active CRM users.
  3. On submitting, a record should be created in the custom module Approvals.
  4. The discount on the Deal should then be set to 20%, and a “Sent for approval” message should be shown. The approval record should be linked in the Discount_Approval lookup field
This scenario requires Client Scripts, a Widget, a Function and a Connection. Let’s see how the skill handles it.

2. From Prompt to Code

Here is the sample prompt to get a solution for the scenario mentioned above.
Quote

/zoho-crm On the Deals module, show an error message next to the Discount field as soon as the discount is more than 20%. When the rep clicks Save, open a widget where they pick an approver from the active CRM users and write a reason. Add this info as a record in the Approvals module using functions, set the discount to 20%, and show a "Sent for approval" message. The new approval record should be linked in the Discount_Approval lookup field.

Watch the video below to see the whole process, from the prompt to the results. The skill generates the required code along with the implementation steps.



3. Which developer tool does what

From this single prompt, the skill identified the developer tool for each part of the requirement.


  1. The error message next to the Discount field is handled using a Client Script (Field Event).
  2. Opening the dialog box, resetting the discount, showing the message, and linking the approval record in the Deal lookup field are handled using a Client Script (Save Event).
  3. The Reason field and Approver dropdown are handled using a Widget.
  4. Creating the record in the Approvals module is handled using a Function.
  5. Secure access to Zoho CRM APIs from the function is provided using a Connection.

4. Implementation steps

Prerequisites :

Before you begin, create the Approvals module and the Discount_Approval lookup field on Deals. The skill lists the field names it has assumed. If your fields already exist, share their API names and the skill will update the code.

Then follow the steps the skill shares, in this order, since some pieces depend on others.

Step 1. Create the Connection
  1. Go to Setup > Developer Space > Connections.
  2. Use the exact name the skill mentions, because the function calls it by name.
  3. Select the listed scopes, authorize, and make sure the connection is in your CRM’s data center.
Step 2. Create the Function
  1. Go to Setup > Developer Space > Functions and create a new function.
  2. Paste the generated code and verify that the API names are correct for your organization.
  3. Save it and test it with sample values using info statements and the execution logs.
Step 3. Upload the Widget
  1. Ask the skill to package the Widget and provide a ZIP file ready to upload.
  2. Go to Setup > Developer Space > Widgets and create a new widget.
  3. Set Hosting to Zoho, upload the ZIP, and give the index page path.
  4. Set the Type to Button, which is required to open it through a Client Script.
Step 4. Create the Client Scripts

  1. Go to Setup > Developer Space > Client Script.
  2. Create the two scripts the skill provides, using the module, page and event it recommends for each.
  3. Paste each script as generated and save.
5. Test the flow
  1. Open a Deal and enter a discount above 20%.
  2. Check that an error message appears next to the Discount field.
  3. Click Save and check that the dialog box opens.
  4. Enter a reason, select an approver, and submit.
  5. Confirm that a record is created in the Approvals module, the discount is set to 20%, and the “Sent for approval” message appears.
  6. Also, the Discount_Approval lookup field should be populated with the corresponding Approval record name

Here is how the implementation works.



6. Tips
  1. Field names: If you have already created fields, give the skill their API names so the code matches.
  2. Debugging: Ask the skill to add debug logs and log statements, which makes issues much easier to trace.
  3. For complex use cases involving multiple developer tools, the skill may not meet every requirement on the first attempt. Refine your prompt and ask again.
  4. You can ask the skill for a ready-to-upload Widget and upload it directly.
7. Summary

We saw how a single prompt led the Zoho CRM Skill to combine a Client Script, a Widget, a Function and a Connection into one working solution, and what to review while setting it up.

8. Related links
  1. Kaizen #258: Getting Started with Zoho CRM Skill
  2. Kaizen #259: Working with Zoho CRM APIs using the Zoho CRM Skill
  3. Kaizen #260: Using Zoho CRM Skill to generate Client Script
  4. Kaizen #263: Using Zoho CRM Skill to Build Widgets
  5. Client Script overview
  6. Widgets

Idea
Previous Kaizen: Working with Zoho CRM using Zoho MCP - Part I | Kaizen Collection: Home