Auto-create tickets for deal stages

Create a support ticket in Zoho Desk automatically for deal-related actions, such as when a deal is won in your CRM.

Creating a support ticket every time you win a deal is beneficial to provide a seamless onboarding experience for your customers. This enables your support team to offer assistance and address any concerns. For instance, a broadband service provider can showcase their dedication to exceptional customer service by creating a support ticket and promptly following up with their customers to complete post-sale activities such as cable extension and router setup.

Presently, it's not possible to create a support ticket for deal-related actions out of the box in your CRM. However, you can write a custom function and link it to a workflow rule to create a support ticket automatically when a deal is deemed qualified or won according to your preference. Read the section below to learn more.

Permissions and availability

  • Users with the Manage Extensibility permission can create connections and write custom functions.
  • Users with the Manage Automation permission can create and update workflow rules.
  • Users with the Manage Sandbox permission can manage the sandbox.

Requirements

  • Create a Zoho OAuth connection with the required scopes for your Zoho CRM, as detailed in the "Create Connection" section below. Learn more
  • Create a workflow rule for the Deals module that will trigger a custom function whenever a specific stage is updated. Learn more
  • Write a custom Deluge function that creates a Zoho Desk ticket in the contact's name for your support reps to follow up. Learn more
  • Test the workflow rule in a sandbox before deploying it in your production environment. Learn more

Create a connection

Follow the below steps to create an OAuth connection in your Zoho CRM account:

  1. Navigate to Setup > Developer Space > Connections.
  2. Click Create Connection.
  3. Select Zoho OAuth under Default Services.
  4. Specify a Connection Name.
    You must enter this name in the code snippet below.
  5. Select the following Scopes to request access.
    • ZohoCRM.modules.all
    • Desk.tickets.CREATE
    • Desk.settings.ALL
    • Desk.search.READ
    • Desk.contacts.ALL Learn more 
  6. Click Create and Connect.
  7. Click Connect, then click Accept to confirm authorization of access for the scopes requested by the client.
Create Connection

Create a workflow rule

  1. Navigate to Setup > Workflow Rules > +Create Rule.
  2. Select the Module as Deals from the drop-down list.
  3. Provide a name for the rule. For example: "Create ticket for Deal". 
  4. Add a description, if required, then click Next.
  5. In the Execute this workflow rule based on section, do the following:
    1. Choose Record Action, then select Create or Edit from the drop-down.
    2. Click Next.
  6. In the Which deals would you like to apply the rule to? section, do the following:
    1. Select Deals matching certain conditions.
    2. Specify the deal stage during which you wish to create a ticket. For example, Stage <is> Closed Won.
    3. Click Next.
  7. Under Instant Actions, select Function and Write your own.
  8. Provide a Name and description, if required, for the function.
  9. On the Deluge Script Editor, do the following:
    1. Copy and paste the code given below.
    2. Click Edit Arguments.
    3. Enter the name as contemail, select the value as Contacts - Email, then click Save.
    4. Click Save & Execute Script.
  10. Click Save on the workflow rule page.

The code

Code Copied
con = zoho.desk.searchRecords(xxxxx,"contacts",{"email":contemail},0,1,"connectionname");
info "co:" + con;
contid = con.get("data").get(0).get("id");
info "con:" + contid;
mp = Map();
//Enter a subject for the ticket
mp.put("subject","Follow-up regarding your recent purchase");
mp.put("contactId",contid);
mp.put("departmentId",yyyyy);
response = zoho.desk.create(xxxxx,"tickets",mp,"connectionname");
info response;

Notes

  • Replace "connectionname" with the name of the connection you specified while creating the connection (see the Create a connection section above).
  • Replace "xxxxx" with the OrgId of the Desk account where you want to create tickets.
  • Replace "yyyyy" with the department ID of the Desk account where you want to create tickets.
  • Make sure to use the accurate API names for their corresponding fields in the code snippet. Learn more
     

Tip

  • Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.

Test the solution

  1. Click the Deals tab.
  2. Open a deal record that you wish to create a ticket for in Desk.
    If necessary, create a new deal for a contact.
  3. Update the deal's stage to the one mentioned in the workflow rule. For example, Closed Won.
  4. Check whether a support ticket has been created in the Zoho Desk account under the contact's name associated with the deal and the subject specified.

Did you find this useful? Try it out and let us know how it works. Share this with your team if they'd benefit from it! If you have questions, please don't hesitate to contact us.

More info

  • ModuleDeals
  • Trigger PointWorkflow Rule
  • EditionEnterprise and above
  • ComplexityHigh
  • Implementation Time60 minutes

Features used in the solution

ConnectionWorkflow RuleDeluge ScriptSandbox
Story Image

Looking for a custom solution?

Contact us, we will help enhance your productivity at lightning speed.

SUBMIT REQUEST

Developers: Share your solution with our community!