CRM Hack #14: How to send emails to Accounts in your CRM?

CRM Hack #14: How to send emails to Accounts in your CRM?


 
Hello everyone, 

Let's start the day with a small hack. Every business is unique and the sales routines vary based on the needs. In Zoho CRM , the Contacts are associated with Accounts through a lookup field. So, the emails section under the Accounts is the list of emails that are sent to the Contacts associated with it. There is no provision to send emails to the account directly. Some of our users have asked for a send mail button in Accounts module similar to the one in Contacts module. This week's hack helps meet this requirement by using a custom module and a custom function. 

By design, the account module does not have the "Send Email" button. This limitation can be overcome by creating a custom module containing the email and few other details that you might need. Use the custom function shared below to automatically push the required details including email id to the new module. The "Send Email" button in a custom module can then be leveraged to send emails directly from the CRM. The new custom module solely serves the purpose of sending emails at the Accounts level and its usage depends on your business needs.

Step 1:

Go to Setup->Customization->Modules and Fields->Create new module->Include email and other relevant fields. As the purpose of this module is to send emails, we don't have to create an exact replica of the Accounts module. More on creating custom modules here

Step 2:

Go to Setup->Workflow rules->Create workflow for Accounts->On record action->Create->Which records->All records->Instant actions->Functions.

  1. New Function
  2. Write your own
  3. Provide a name for the function.
  4. Copy the code given below.
  5. Click “ Edit arguments ”.
  6. Enter the name as “ acctId ” and select the value as “ Account Id ”.
  7. Save the changes.
  8. Save the workflow.

Code :

AccountDetails = zoho.crm.getRecordById("Accounts",acctId);
createMap = map();
createMap.put("Name", ifnull(AccountDetails.get("Account_Name"),""));
createMap.put("Owner", ifnull(AccountDetails.get("Owner"),""));
createMap.put("Phone", ifnull(AccountDetails.get("Phone"),""));
createMap.put("Email", ifnull(AccountDetails.get("Email"),""));
createCustomModule = zoho.crm.create("CustomModule_API_Name", createMap);
info createCustomModule;








  

Note: I have created the custom function to work with CustomModule14. The sequence for you might vary. In the above code, replace "CustomModule14" with the API name of your custom module in the 2 places highlighted above. Now the workflow and the function is setup. All future Accounts would create a similar record in this Custom module automatically.

Follow the below-listed steps to use this custom function with retrospective effect on accounts created earlier:

Step 1:

Go to Setup->Automation->Workflow rules->Click that workflow->Change the On Record action to "Edit"->Save the workflow.

Step 2:

Go to Setup->Modules and Fields->Click on Accounts->Drag and Drop a Checkbox field->Save the layout.

Step 3: 

Mass update this checkbox field to all your accounts and then the Custom module records will be created. Once this action is done, revert the Workflow changes to "Create" mode.

Check out other hacks shared in this series here.