Zoho CRM is a powerful customer relationship management tool that helps businesses of all sizes manage their customer interactions and sales activities. Today we will be helping you to achieve one of the most demanding features of sending email notifications in Zoho crm conditionally using deluge. This can be done using the Deluge scripting language, which is built into Zoho CRM.

Deluge is a simple, yet powerful scripting language that allows you to create custom workflows and automation within Zoho CRM. Using Deluge, you can create scripts that automatically trigger email notifications based on certain conditions, such as when a new lead is created, or when a customer’s account is updated.

To send email notifications in Zoho CRM conditionally for related Lists using Deluge, you will first need to create a custom function that checks for the desired conditions. This function can be created in the Deluge script editor, which is available in the Zoho CRM settings.

Let’s assume an example for this use-case.

Let’s assume, we have a company record and it has a large set of fields, and one of them is called “Company Type” which is a select field with two values

  1. Direct
  2. Referral

Direct Company Structure

Direct Company is dealing with your organization for all communication/business activities directly without any third-party involvement and each company has multiple shareholders that your organization keep in the CRM as related list records.

Referral Company structure

In Referral company, everything is same as above like Company and its related Stakeholders, But the communication between the company and your organization is being done via the Referred party.

So In today’s scenario, We need to send an automated notification to companies 30 days prior to the Agreement expiration date (The agreement expiration date is a custom date field in the Company module in Zoho CRM). But here is another condition.

If the company type is Direct, then the notification will be sent to all related Stakeholders of the company and if the company type is referral then the notification will be sent to the Referral authority (Referral Authority Name and Emails are already included in the Company profile in CRM). And there is also one more condition if the Company Status is Expired then the notification wouldn’t be sent but if the Status is Active then the notification will be sent.

So as per the above use case, we can’t trigger the notification in basic workflow features in Zoho CRM and that’s why we will need to use Deluge. So Let’s jump into the code that we will use and the steps we need to follow to step up the workflow.

Steps to set up the Email notifications in Zoho CRM

Email Notifications in Zoho CRM
  1. Login to your Zoho CRM & Navigate to Workflows
  2. Click on “Create Rule + “
  3. Add Workflow Rule Name
  4. Select A Trigger Point
  5. Select Date/Time Based
  6. Select the Date from the dropdown that you will consider for the workflow to trigger
  7. Select other conditions in the DateTime base action Popup as per requirements & Click Next
  8. Select Additional Conditions Like for Specific companies or All Companies
  9. Select Function in Instant Action Dropdown List

Now Copy the below code if it matches your complete requirements and make sure your adjust the Fields/Module’s API Names as per your system API Details.

data = zoho.crm.getRecordById("Accounts",id);
Status = data.getJSON("Company_Status");
Type = data.getJSON("Type");
if(Status == "Active" && Type == "Direct")
	RelData = zoho.crm.getRelatedRecords("Stakeholders2","Accounts",id);
	StakeID = List();
	for each  rel in RelData
		StakeData = zoho.crm.getRecordById("Stakeholders",rel.getJSON("Stakeholders").get("id"));
		StakeEmail = StakeData.getJSON("Email");
		//Send Email function
			from :zoho.adminuserid
			to :StakeEmail
			subject :"Company Business Reminder"
			message :"This is a test message description"
		info "Emails sent to the stakeholders";
else if(Status == "Active" && Type == "Referral")
	ReferrerEmail = data.getJSON("Referrer_Email");
		from :zoho.adminuserid
		to :ReferrerEmail
		subject :"Company Business Reminder"
		message :"This is a test message description"
	info "Email Sent to the Referrer";

In conclusion, Deluge is a powerful scripting language that allows you to automate tasks and send email notifications in Zoho CRM. By creating custom functions and linking them to appropriate triggers, you can create automated workflows that save time and streamline your business processes. With Deluge, you can create conditional statements that only execute when certain conditions are met. We hope this article helped you to achieve your goal to implement complex automation for your business.

Leave a Reply

Your email address will not be published. Required fields are marked *