Create Tasks or Scheduled Calls (from a Google Sheet) with Deluge Scripts

Create Tasks or Scheduled Calls (from a Google Sheet) with Deluge Scripts

Hi Zoho gurus,

During the migration of our old (SugarOnDemand)  to Zoho CRM,  I had several hundred calls and tasks that needed to be added to cover the gap in operations.   However, a regular import could mess with the migration process - plus there is always a need to bring in tasks and calls.  For example, set up tasks and call scheduled in support of external events.

I've created two Flows that may be useful for others.  One for adding Tasks and the other for adding Scheduled calls.  Currently, this flow monitors a Google Sheet (but you could set this up to be fired off any source) and adds a task or sheet for each new row.  You could also hook this up to form or survey, etc.

I did NOT put error checking logic into this flow, as I knew all my data was clean. 

To add such, you'd use decision blocks to check the ID of the various elements.

Flow:  Add Task to a Contact, Account and Owner



These flows make use of a few custom deluge scripts, which are what this post is really all about. Here are the scripts.

Extract Account ID from a Contact Record
Why: The Account Name field on a fetched contact record is actually a map with both the name and the id.  So you need to separate out the account's id in order to accurately fetch the full account record, and also to associate the account record to the Related To  field of both Call and Task records.

string ExtractAccountID(string accountmap)
{
mp = Map();
mp = accountmap;
return mp.get("id");
}

ExtractAccountName
This is similar to the above, but instead of return the account id, it returns the account name.

string ExtractAccountName(string accountmap)
{
mp = Map();
mp = accountmap;
return mp.get("name");
}

Formatting Dates
Gawd!  You need to be a rocket surgeon to work with dates in Zoho Deluge. I took to formatting the incoming dates in my sheet into two strictly formatted style: yyyy-MM-dd for dates and HH:mm:ss for time.
Even so, I still created a date formatter, so I would have only one place to make changes if I needed to.

string StringDateProcessor(string strdate, string strtime)
{
return strdate + "T" + strtime + "+11:00";
// following is other code I was messing about this... you get the idea.
//calctime = zoho.currenttime.addDay(1);
//return calctime.toString("yyyy-MM-dd'T'HH:mm:ss'+10:00'");
//toTime(datetimeString,"d,MM,yyyy hh:mm a","Australia/NSW");
}


Scheduling a Task
Now we get to the fun stuff!  The actual scheduling.   We have fetch the records we need (the user record to be the task owner, the contact record for the contact association on the task, and the account id which will be used  on the Related To of the task.

I've placed comments throughout this code example so you know what's going on and why.

In addition, you'll see some custom fields (I've marked them in grey) that I had added to the tasks.  You can just ignore these.  

void SheduleTask(string name, string ownerid, string callstart, string contacttid, string phone, string mobile, string purpose, string accountid, string accountname)
{
// set up the map to hold the task information to be created
mp = Map();
// the subject name comes from the trigger app (in our case google sheets)
mp.put("Subject",name);
// the ownerid comes from the fetch user step of the flow.
mp.put("Owner",ownerid);
// the due date is a correctly formatted date in yyyy-MM-dd format - in this case from the trigger app
mp.put("Due_Date",callstart);
// these two fields are taken from fetched contact record - the contact record is found by the email address
mp.put("Phone",phone);
mp.put("Mobile",mobile);
// hard coded - this is scheduling calls, after all!
mp.put("Status","Scheduled");
mp.put("Priority","Low");
// another custom field, purpose, is passed from the trigger app
mp.put("Task_Purpose",purpose);
// the contacttid is the contact id and it comes from the fetched contact record
mp.put("Who_Id",contacttid);
// you need to use the map format to link the task to the Related To field of the account.
// You also need to set the $se_module to "Accounts"
accInfo = {"name":accountname,"id":accountid};
mp.put("$se_module","Accounts");
mp.put("What_Id",accInfo);
// now you create the new task record!  FINALLY
create = zoho.crm.createRecord("Tasks",mp);
info mp; 
info create;
}

Scheduling a Call
Scheduling a call is almost identical to the Task, but it needs a data time format (tasks only use date)

void SheduleACall(string name, string ownerid, string callstart, string contacttid, string purpose, string accountid, string accountname)
{
mp = Map();
mp.put("Subject",name);
mp.put("Owner",ownerid);
mp.put("Call_Start_Time",callstart);
mp.put("Call_Type","Outbound");
mp.put("Call_Purpose","Prospecting");
mp.put("Who_Id",contacttid);
accInfo = {"name":accountname,"id":accountid};
mp.put("$se_module","Accounts");
mp.put("What_Id",accInfo);
mp.put("$which_call","ScheduleCall");
create = zoho.crm.createRecord("Calls",mp);
info mp;
info create;
}

I hope this is useful. Enjoy!

    • Recent Topics

    • Pricing Strategies: #5 Stay local, Price & Sell Global

      Arun had always dreamed of taking his handmade craft business beyond his hometown. For years, he sold locally. Most of his customers are familiar faces, in our usual currency and with the exact expectations. But one day, a traveller visited his workshop
    • Zoho CRM for Everyone's NextGen UI Gets an Upgrade

      Hello Everyone We've made improvements to Zoho CRM for Everyone's Nextgen UI. These changes are the result of valuable feedback from you where we’ve focused on improving usability, providing wider screen space, and making navigation smoother so everything
    • What is the easiest way to move Hotmail emails to an IMAP server?

      The easiest way to move Hotmail (Outlook.com) emails to an IMAP server is to add your Hotmail account directly to any email client that supports IMAP, then copy the messages across. This avoids paid tools and keeps the process simple. Fastest free method:
    • No feedback from Zoho Books regarding Yodlee feeds for Investec

      I reported on 6 Feb 2025 that the Bank Feeds for Investec bank via Yodlee are not working. To date there has been no resolution. You are charging us for a suite of products where the functionality does not work. Please advise how you will refund me for
    • Turn off Knowlege Base Follow options and Follower lists

      Is there a way to hide or turn off the option in the Knowledge Base for users to follow specific departments/categories/sections/articles? If not, is there a way to turn off the public list of followers for each of those things? Otherwise, customer names
    • Custom validation in CRM schema

      Validation rules in CRM layouts work nicely, good docs by @Kiran Karthik P https://help.zoho.com/portal/en/kb/crm/customize-crm-account/validation-rules/articles/create-validation-rules I'd prefer validating data input 'closer to the schema'
    • Suggestion: Option to Re-run a migration

      As I'm going through a migration process, I like the IMAP migration tool, but it would be better if there were an option to re-run the same migration as configured. There's not even an option to copy/edit one that's already there. Just run if it hasn't
    • Text snippet

      There is a nice feature in Zoho Desk called Text Snippet. It allows you to insert a bit of text anywhere in a reply that you are typing. That would be nice to have that option in Zoho CRM as well when we compose an email. Moderation Update: We agree that
    • Service One. Bill Another. Zero Hassle.

      In field service operations, one challenge often comes up: the person who needs the service isn’t always the one who pays for it. Think about tenants vs. property managers, corporate offices vs. their finance departments, or school buildings vs. central
    • Presenting ABM for Zoho CRM: Expand and retain your customers with precision

      Picture this scenario: You're a growing SaaS company ready to launch a powerful business suite, and are looking to gain traction and momentum. But as a business with a tight budget, you know acquiring new customers is slow, expensive, and often delivers
    • Can Zoho Flows repeat Actions more than once?

      I'm attempting to make an intentional Zoho Flow loop using the below layout. However, when "WithinLimit" condition is met, the program fails to execute the action "Get & Add Request Co..." again. Is this by design? Is Zoho Flows unable to repeat actions
    • Video interviews not compatible on mobile

      Hi Zoho,  The 2-way video interview feature you have added to Recruit would be great if the candidate was able to use the link to the video on a mobile phone, it doesn't work on Samsung browser, it doesn't work on chrome/firefox mobile version of browser,
    • Zoho Desk View Open Tickets and Open Shared Tickets

      Hi, I would like to create a custom view so that an agent can view all the open tickets he has access to, including the shared tickets created by a different department. Currently my team has to swich between two views (Open Tickets and Shared Open Tickets).
    • Enviro Recycling EHF Fee's

      ​​I'm in Canada and each province has it's own recycling program with it's own fee's. There are numerous categories that electronics fall into and each category has a taxable rate applied to it. I need a way to be able to apply the correct rate depending
    • Zoho Desk API - Influence which layout is used

      Hello, how can the ticket layout be changed using the API? I would like to choose the layout directly when creating the ticket. If this is not possible, my question would be how can I change it afterwards? Best regards, Sven
    • Has CSS Changed for Common Elements?

      I noticed today that the standard title headings on my Forms and Reports display smaller in size than before. Google Dev Tools (attached), seems to confirm my suspicion. Something appears to be overriding the 1.375rem to 1.125rem. The font size on the
    • Text field alignment

      Is it possible to align text in the text field? Or even better, is there a possibility to have a field which accepts only numbers?
    • email moderation issue when email is sent in the name of a mail group

      Symptom: an email that is sent by a mail group moderator in the name of a moderated mail group is held back for approval. Reproduction: Create a moderated mail group with members and moderators. Allow that mails can be sent in the name of the group (extended
    • Pipeline in Custom Modules

      I love the way the Sales Pipeline looks and functions with reports. I would like to add the save pipeline features and visualization to a custom module, however, I only see that these pipelines are only available for the Deals module. Is there a way to add pipelines to custom modules?
    • Tip #53- Remote Billing: Your End-to-End Billing Solution in Zoho Assist- 'Insider Insights'

      Manual invoicing, after every remote support session, can be time-consuming and often error-prone. As an MSP, IT admin, or even a freelance support technician, it may become overwhelming to keep track of session time, service rates, and client invoices.
    • Record history and ticket interaction tab in contacts and accounts

      Hello everyone! We have improved the History tab to help users trace updates in the interaction activity logs of the Contacts and Accounts detail pages in the Customer Module. This enhancement make it easier to get clear details about who made each update,
    • sync views to sheet

      Im looking to sync my views aka reports in analytics to zoho sheets, when data is updated in analytics it also should be updated in sheets, till now zoho sheets only offer raw data connection and it is not enough as these reports are difficult to re-do
    • Is there an API to "File a Ticket" in Desk

      Hi, Is there an API to "File a Ticket" in Desk to zoho projects?
    • Keyboard UX for Assemblies

      The new Assembly module has a counter-intuitive behavior that ought to be corrected. When an Assembly is ready to be entered, there are two options given, the blue-highlighted "Assemble" and the gray "Save as Draft". This correctly implies that the normal
    • How to Move Behavior, Acquisition, Polls & Forms Data from Zoho PageSense to Zoho Analytics?

      Hi Zoho Community, I'm looking for a way to transfer data from Zoho PageSense to Zoho Analytics, specifically: Behavioral data (clicks, scrolls, heatmaps, etc.) Acquisition data (traffic sources, campaigns, etc.) Polls and forms data As far as I can tell:
    • Why can't I see images uploaded by other users in the Library for Campaigns

      We are several users of zoho Campaign. I have uploaded visuals of our company, but my team members can't see them.
    • zoho sheet stuck

      I Need help. ZOHO sheets stuck on the loading screen. I've already deleted the system cache and cookies of my browser (google chrome) but it's still not opening. 
    • Tip of the Week #78 – Cut response time with multichannel shared inboxes

      If you’ve ever felt your team juggling between multiple email accounts, social pages, and chat apps just to reply to customers, you’re not alone. Managing conversations in multiple channels can quickly turn messy. Important messages across inboxes, replies
    • Need a way to run a client script longet than 10 seconds

      By The Grace of G-D. Hi, Currently, Client Scripts are Timing out at 10 seconds. We have complex logics that needs more time. Can you add a feature request to increase the timeout?
    • FSM Improvement Idea - Show an Import button when there is no data

      I am setting up FSM for a client and I noticed that there is no option to import data, see screenshot below. Even when you click Create Contact there is only an option to Import from Zoho Invoice. It is only after you add at lease 1 record that the Import
    • Unable to Send Different Email Templates for Different Documents in Zoho Sign

      Hello Zoho Community, I am facing a limitation with Zoho Sign regarding email notifications sent to customers when a document is sent for signing. Currently, whenever I send any template/document for signing, the email notification that goes to the customer
    • Timeline Tracking Support for records updates via module import and bulk write api

      Note: This update is currently available in Early Access and will soon be rolled out across all data centers (DCs) and for all editions of Zoho CRM. The update will be available to all users within your organization, regardless of their profiles or roles.
    • UI Improvement - Ability to Collapse Flow

      The UI for Flow is generally pretty good. However, when multiple decision trees are used, the layout can get pretty convoluted and hard-to-follow (see one of my Flows below): In these cases, even the auto-arrange fails to make this something that a normal
    • Tasks Statuses

      Hi, The task status "Completed" is a final status which closes the task. We need to have a status "Cancelled". However, when the status is set to "Cancelled", the task prompt still has a blue button to Close Task. When the customer clicks that and closes
    • Add Lookup Field in Tasks Module

      Hello, I have a need to add a Lookup field in addition to the ones that are already there in the Tasks module. I've seen this thread and so understand that the reason lookup fields may not be part of it is that there are already links to the tables (
    • Create New Tasks Layout in CRM

      I am able to do this in Leads, Contacts, Meetings, Calls - every other module, but cannot create a new layout in tasks. I have the appropriate access but it's simply not appearing as an option. Only "Standard" option shows. Please help!
    • Whatsapp Connection Status still "Pending" after migration

      Hello, I migrated my WhatsApp API to Zoho from another provider a day ago. So far the connection status is still “Pending”. There is a problem? How long does it usually take?
    • Using IMAP configuration for shared email inboxes

      Our customer service team utilizes shared email boxes to allow multiple people to view and handle incoming customer requests. For example, the customer sends an email to info@xxxx.com and multiple people can view it and handle the request. How can I configure
    • Auto-sync field of lookup value

      This feature has been requested many times in the discussion Field of Lookup Announcement and this post aims to track it separately. At the moment the value of a 'field of lookup' is a snapshot but once the parent lookup field is updated the values diverge.
    • Zoho Recruit Subscription

      Hello Zoho Recruit Team, Good day! I would like to inquire about your recruitment subscription plans and would also like to verify the current subscription our company is enrolled in under Zoho Recruit. Thank you, and I look forward to your response.
    • Next Page