Welcome back everyone!
Business scenario
Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly.
CRM allows to make or take calls directly from the interface, instead of calling from a separate phone. And through this interface, calls can be facilitated within CRM. And while this is a handy feature, a peculiar issue pops up when the call process is automated. Call scheduling cannot be automated, but they could be scheduled as a task. And when the task reminder pops up, agent can make the call.
Wouldn't it be better to directly schedule the call? Many of our customers have been asked for options to automate call scheduling and the Function I'm sharing this week helps you do just that.
Getting started with the function
- Go to Setup > Customization > Modules and Fields > Leads > Links and buttons > + Create new button.
- Provide a name for the button. For example: "Schedule Call". Add a description(optional).
- Select the placement of the button as View page.
- Select the action to be performed as "Writing function".
- Copy the code given below.
- Click “Edit arguments”.
- Enter the name as “leadId” and select the value as “Lead Id”.
- Click Save&Execute Script.
- Save the script.
- Select the profiles who can view this button.
- Click Save.
The Code
-----------------------------------------------------------------------------------------------------------------------
leadDetails = zoho.crm.getRecordById("Leads", input.leadId);
createdtime = ifnull(leadDetails.get("Created_Time"),"").toTime("yyyy-MM-dd'T'HH:mm:ss").addDay(3);
mp = map();
mp.put("Subject", "Cold Call");
mp.put("Owner", ifnull(leadDetails.get("Owner"),"").get("id"));
mp.put("Call_Type", "Outbound");
mp.put("$se_module", "Leads");
mp.put("What_Id", input.leadId);
mp.put("Call_Start_Time", createdtime.toString("yyyy-MM-dd'T'HH:mm:ss+05:30"));
mp.put("$which_call", "ScheduleCall");
create = zoho.crm.create("Calls", mp);
info mp;
info create;
return "Success";
-----------------------------------------------------------------------------------------------------------------------
Note
- The code given above works only for V2 version of Zoho APIs. Please note that the code WILL NOT work for Version 1.0 APIs.
- You need to set this function under a Module, like 'Leads'. You can also set this function to trigger for any module you want.
Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Do check out other functions shared in this series here.
See you all next week with another interesting function. Ciao!