Function-17: Auto-update tasks with details from related record modules.

Function-17: Auto-update tasks with details from related record modules.



Welcome back everyone!

Last week, we learnt how to send automatic updates on deal progression by stage to all Contact Roles. This week, let's look at a custom function that fetches record details from related CRM modules right inside the task records..

Business scenario:

Tasks in Zoho CRM helps organize your to-do-lists efficiently. It not only helps keep a tab on your to-do-lists, but also enables easy access to related record in other modules. This for sure, makes you productive. What if I say there is a possibility of taking this one step ahead? While Tasks enables easy access to related records associated with the task records, won’t it be great if it were to fetch all the required information from the related record modules to complete the task?

Such a possibility cuts down on the need to loop between the task record and the related record module - say for example between the lead record and the associated task record. This week’s custom function helps you do just that. It auto-updates the custom fields in task records with required details from the related record modules.

Pre-requisites:

  • As custom functions are module specific, you need to update the appropriate custom function individually for the respective modules that require the auto-update functionality. We have covered four use cases with certain important fields in the below code. For instance, the code shared for Leads module auto-updates the State and Phone number details from the Leads module on the task record's custom fields. Choose the ones that fits your sales process and update the required field parameters accordingly.
  • Add the required custom fields in the Tasks Layouts. Go to Setup > Customization > Module and Fields > Tasks > Layouts , drag and drop the required custom fields. The details fetched from the respective record modules gets updated in these custom fields. 
Getting started with the custom function:

  1. Go to Setup > Automation > Actions > Custom Functions > Configure Custom Function > Write your own .
  2. Provide a name for the button. For example: “Auto update tasks.”. Add a description(optional).
  3. Choose the module as " Tasks ".
  4. Click “ Free flow scripting ”.
  5. Copy the code given below.
  6. Click “ Edit arguments ”.
  7. Enter the name as “ taskId ” and select the value as “ Task Id ”.
  8. Save the changes.
The script:

Code for Version 2.0 API:
 
taskDetails = zoho.crm.getRecordById("Tasks", input.taskId.toLong());
//info taskDetails;
whatid = ifnull(taskDetails.get("What_Id"),"");
whoid = ifnull(taskDetails.get("Who_Id"),"");
if( whatid != "")
{
recordid = ifnull(taskDetails.get("What_Id"),"").get("id")''
module = ifnull(taskDetails.get("se_module"),"");
getDetails = zoho.crm.getRecordById(module, whatid);
timezone = ifnull(getDetails.get("Time_Zone"),"");
mp=map();
mp.put("Time_Zone",timezone);
update = zoho.crm.update("Tasks", taskId, mp);
info mp;
info update;
}
if( whoid != "")
{
contid = ifnull(taskDetails.get("Who_Id"),"").get("id");
getDetails = zoho.crm.getRecordById("Contacts", contid);
timezone = ifnull(getDetails.get("Time_Zone"),"");
mp=map();
mp.put("Time_Zone",timezone);
update = zoho.crm.update("Tasks", taskId, mp);
info mp;
info update;
}

Code for Version 1.0 API:

1) Update Tasks from Leads :

taskIdStr=input.taskId.toString();
taskDetails = zoho.crm.getRecordById("Tasks", input.taskId);
module = ifnull(taskDetails.get("SEMODULE"),"");
id = ifnull(taskDetails.get("RELATEDTOID"),"");
if ( module == "Leads")
{
leadDetails = zoho.crm.getRecordById(("Leads"), id.toLong());
mp=map();
mp.put("State",ifnull(leadDetails.get("State"),""));
mp.put("Phone",ifnull(leadDetails.get("Phone"),""));
update=zoho.crm.updateRecord("Tasks", taskIdStr, mp);
info mp;
info update;
}

2) Update Tasks from Contacts :

taskIdStr = input.taskId.toString();
taskDetails = zoho.crm.getRecordById("Tasks", input.taskId);
contid = ifnull(taskDetails.get("CONTACTID"),"");
if ( contid != "")
{
contDetails = zoho.crm.getRecordById("Contacts", contid.toLong());
contmap = map();
contmap.put("Title", ifnull(contDetails.get("Title"),""));
contupdate = zoho.crm.updateRecord("Tasks", taskIdStr, contmap);
info contmap;
info contupdate;
}

3) Update Tasks from Solutions :

taskIdStr = input.taskId.toString();
taskdetails = zoho.crm.getRecordById("Tasks", input.taskId);
module = ifnull(taskdetails.get("SEMODULE"),"");
id = ifnull(taskdetails.get("RELATEDTOID"),"");
if ( module == "Solutions")
{
solutionsDetails = zoho.crm.getRecordById(("Solutions"), id.toLong());
mp=map();
mp.put("Subject",ifnull(solutionsDetails.get("Solution Title"),""));
mp.put("SMOWNERID",ifnull(solutionsDetails.get("SMOWNERID"),""));
mp.put("Description",ifnull(solutionsDetails.get("Additional Information"),""));
mp.put("Due Date", ifnull(solutionsDetails.get("Deadline Date"),""));
update=zoho.crm.updateRecord("Tasks", taskIdStr, mp);
}

4) Update Tasks from Accounts :

taskIdStr = input.taskId.toString();
taskDetails = zoho.crm.getRecordById("Tasks", input.taskId);
module = ifnull(taskDetails.get("SEMODULE"),"");
id = ifnull(taskDetails.get("RELATEDTOID"),"");
if ( module == "Accounts")
{
acctDetails = zoho.crm.getRecordById("Accounts", id.toLong());
acctmap = map();
acctmap.put("SQFT", ifnull(acctDetails.get("SQFT"),""));
acctmap.put("Lease Commencement", ifnull(acctDetails.get("Lease Commencement"),""));
acctmap.put("Termination Date", ifnull(acctDetails.get("Termination Date"),""));
acctmap.put("Lease Expiration", ifnull(acctDetails.get("Lease Expiration"),""));
acctupdate = zoho.crm.updateRecord("Tasks", taskIdStr, acctmap);
info acctmap;
info acctupdate;
}

--------------------------------------------------------------------------------------------------------------------------

Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful.

Do check out other custom functions shared in this series here.

See you all next week with another interesting custom function. Ciao!

Update: As you must be aware, API V1.0 will be deprecated and support for version 1.0 API will be available only till Dec 31, 2018. Version 1.0 compatible Functions will continue to work until Dec 31, 2019. You're advised to migrated to API Version 2.0 at the earliest. Check this announcement for more. We've updated the post to include the Version 2.0 compatible Function.
    • Sticky Posts

    • How to reach the official Zoho Support channels and avoid fake ones.

      Dear Customers, Thanks a lot for choosing Zoho! Our applications are built to help achieve your day-to-day business goals. We are committed to engaging with you, to understand and develop solutions that enhance your productivity.  We are happy and ready to help you use our services effectively. Understanding and avoiding fake support Just like using popular bank names and financial applications for phishing purposes, using Zoho and claiming to be providing Zoho Support or services with false numbers
    • Function #35: Close all tasks associated with a lead and create a new task.

      Welcome back everyone! Last week, we learnt how to close all tasks of a deal depending upon the deal stage. This week, let's look at a custom function that lets you close all of the tasks associated with a lead while simultaneously creating a new task, like when you need to halt all progress towards a lead while the lead is not available at the moment but create a reminder task. Business scenario: The success of a company, in one way or another, is determined by the leads it gets. Each lead is just
    • Zoho CRM Webinar - Redesigning Daily User Experiences with Canvas

      <br> Your users across roles use the CRM for day-to-day tasks that are necessary. Whether they perform their tasks on time, the right way, or at all depends on a lot of factors, including User Experience. Many businesses struggle with rigid layouts,
    • Join us at the Canada ZUG Meetup: What’s New in Zoho CRM

      Hello Zoho Community! Start your year with fresh insights into Zoho CRM’s latest updates and tools. Whether you're a CRM beginner or a experienced user, this meetup is crafted to help you optimise your processes and leverage new features. Explore practical
    • CRM Hack #2: Automate sending of birthday greetings to your customers.

        Hello everyone! What sets you apart as a sales person is your ability to add that personal touch to your business relationship with your customers. Sending a gift on a special day, or leaving a note wishing them on their birthdays, are small, yet significant actions that show your customers that you care. And these are actions done without any expectations :) You must be engaging with a lot of customers and it is highly unlikely that they all are your friends on Facebook or some social channel,
    • Recent Topics

    • New Series Announcement - Ecommerce Marketing Tips

      Running an online business is more than just having a website. It’s about getting the right customers to discover you, trust you, and keep coming back. To support your growth journey, we’re launching a weekly Marketing Tips series right here on Zoho Commerce
    • Client Script | Update - Introducing Subform Events and Actions

      Are you making the most of your subforms in Zoho CRM? Do you wish you could automate subform interactions and enhance user experience effortlessly? What if you had Client APIs and events specifically designed for subforms? We are thrilled to introduce
    • {"errors":[{"id":"500","title":"Servlet execution threw an exception"}]}

      Here's the call to move a file to trash. The resource_id is accurate and the file is present. header = Map(); header.put("Accept","application/vnd.api+json"); data = Map(); data_param1 = Map(); att_param1 = Map(); att_param1.put("status",51); data_param1.put("attributes",att_param1);
    • Converting Sales Order to Invoice via API; Problem with decimal places tax

      We are having problems converting a Sales Order to an Invoice via API Call. The cause of the issue is, that the Tax value in a Sales Order is sometimes calculated with up to 16 decimal places (e.g. 0.8730000000000001). The max decimal places allowed in
    • Zoho Canvas - Custom templates for related lists

      Hi, I see that the example pages load always one of our related lists in a custom template, but I dont know how to work with that:  1) How can i make my own custom templates for related lists?  2) Where and how can i check out existing custom templates?
    • Kaizen #147 - Frequently Asked Questions on Zoho CRM Widgets

      Heya! It's Kaizen time again, folks! This week, we aim to address common queries about Zoho CRM Widgets through frequently asked questions from our developer forum. Take a quick glance at these FAQs and learn from your peers' inquiries. 1. Where can I
    • open word file in zoho writer desktop version

      "How can I open a Microsoft Word (.doc or .docx) file in Zoho Writer if I only have the file saved on my computer and Zoho Writer doesn't appear as an option when I try 'Open with'? Is there a way to directly open the .doc file in Zoho Writer?"
    • How to invite friends on other social media platforms to one of my group chats in arattai?

      Hello, I have formed chat groups in arattai. I want to invite my friends on other social media platforms like WhatsApp/ FB to one of my groups. Different friends would be invited to different groups. How to share an invite link of one of my groups to
    • Zoho PDF editor has a lot of issues.

      Zoho PDF editor needs a lot of work. It hangs and glitches a lot. Deletes annotations and clearings randomly.
    • Zohom mail

      Plz resolve the problem . I hope u understand .
    • Clients not receiving emails

      I've been informed that my emails are not being received. Is there anything that I should look into to rectify this? Many thanks!
    • stock

      bom/bse : stock details or price =STOCK(C14;"price") not showing issue is #N/A! kindly resolve this problem
    • Zoho sheet desktop version

      Hi Zoho team Where can I access desktop version of zoho sheets? It is important as web version is slow and requires one to be online all the time to do even basic work. If it is available, please guide me to the same.
    • ZOHO SHEETS

      Where can I access desktop version of zoho sheets? It is important to do basic work If it is available, please guide me to the same
    • Zoho Books - France

      L’équipe de Zoho France reçoit régulièrement des questions sur la conformité de ses applications de finances (Zoho Books/ Zoho Invoice) pour le marché français. Voici quelques points pour clarifier la question : Zoho Books est un logiciel de comptabilité
    • Using Zoho Flow to create sales orders from won deal in Zoho CRM

      Hi there, We are using Zoho Flow to create sales orders automatically when a deal is won in Zoho CRM. However, the sales order requires "Product Details" to be passed in "jsonobject", and is resulting in this error: Zoho CRM says "Invalid input for invalid
    • Is Zoho Sheet available for Linux ?

      Is Zoho Sheet available for Linux ?
    • Bharat

      a
    • how to disable staff selection Zoho Booking integrated to SalesIQ?

      currently there is only one Consultant in my Zoho Bookings like this I integrate Zoho Bookings into Zoho SalesIQ to create a chatbot. Unfortunately, even though I only have one consultant for a consultation, the user have to pick the consultant. It will
    • Zoho Bookings No Sync with Outlook

      Zoho Bookings appointments are showing on my Outlook Calendar but Outlook events are not showing on Zoho Bookings. How do I fix this?
    • End Date in Zoho Bookings

      When I give my appointments a 30 minutes time I would expect the software not to even show the End Time.  But it actually makes the user pick an End Time.  Did I just miss a setting?  
    • Custom confirmation message

      How can I change the message that users see after they submit the booking form? I have to confirm some details before their appointment is officially "confirmed", so I want to change it where it doesn't say their appointment is "confirmed" but rather
    • Issue showing too many consultations in my workspace link.

      Hi Team, I’ve set up two Workspaces to track meetings from different sources. So far, this has been working well, and the two Workspaces are differentiated without any issues. However, when I navigate to Consultations and share the link to my personal
    • Deluge sendmail in Zoho Desk schedule can't send email from a verified email address

      I am trying to add a scheduled action with ZDesk using a Deluge function that sends a weekly email to specific ticket client contacts I've already verified the email address for use in ZDesk, but sendmail won't allow it in its "from:" clause. I've attached
    • Zoho Learn & Zoho Connect

      Hi, Is there a way to sync the knowledge base we have in Zoho Learn with the manuals section is Zoho Connect? Thanks,
    • Addin Support in Zoho Sheet

      Is there any addin support available in zoho sheet as like google marketplace to enhance productivity by connecting with other apps, providing AI data analysis, streamlining business processes, and more?
    • Changing Corporate Structure - How Best to Adapt Current and Future Zoho Instances

      My current company is Company A LLC with a dba ("doing business as" - essentially an alias) Product Name B. Basically, Company A is the legal entity and Product Name B is what customers see, but it's all one business right now. We currently have a Zoho
    • how to add subform over sigma in the CRM

      my new module don't have any subform available any way to add this from sigma or from the crm
    • How to Install Zoho Workdrive Desktop Sync for Ubuntu?

      Hi. I am newbie to Linux / Ubuntu. I downloaded a tar.gz file from Workdrive for installing the Workdrive Desktop Sync tool. Can someone give me step by step guide on how to install this on Ubuntu? I am using Ubuntu 19.04. Regards Senthil
    • How to upload own video?

      How can you upload your own video on your zoho website? I do not want to use another host, but i want to insert my own files. how can i do this?
    • Support new line in CRM Multiline text field display in Zoho Deluge

      Hi brainstrust, We have a Zoho CRM field which is a Muti Line (Small) field. It has data in it that has a carriage return after each line: When I pull that data in via Deluge, it displays as: I'm hoping a way I can change it from: Freehand : ENABLED Chenille
    • Announcing new features in Trident for Windows (v.1.32.5.0)

      Hello Community! Trident for Windows just got better! This update includes new features designed to improve and simplify email and calendar management—and it includes a feature you’ve been waiting for. Let’s dive into what’s new! Save emails in EML or
    • How to render either thumbnail_url or preview_url or preview_data_url

      I get 401 Unauthorised when using these urls in the <img> tag src attribute. Guide me on how to use them!
    • Zoho CRM Calendar | Custom Buttons

      I'm working with my sales team to make our scheduling process easier for our team. We primary rely on Zoho CRM calendar to organize our events for our sales team. I was wondering if there is a way to add custom button in the Calendar view on events/meeting
    • Max numbr of IMAP Accounts in Zoho Mail?

      In Zoho mail, you can manage the inboxes of other accounts using IMAP (and POP, actually) https://www.zoho.com/mail/help/external-imap-accounts.html Is there a max to the number of inboxes we can add?
    • Create Lead Button in Zoho CRM Dashboard

      Right now to create Leads in the CRM our team is going into the Lead module, selecting the "Create Lead" button, then building out the lead. Is there anyway to add the "Create Lead" button or some sort of short cut to the Zoho CRM Dashboard to cut out
    • Searching customer field

      Hello, When entering a receipt, we select customer information. The customer information is synced with Zoho CRM. However, we can't find the customer information because it searches for words that begin with the entered value. It needs to search for words
    • Introducing Version-3 APIs - Explore New APIs & Enhancements

      Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
    • Zoho CRM Tracking Google Enhanced Conversions

      Can anyone @Zoho, consultants, or users help me understand if Zoho CRM is going to support Google's Enhanced Conversions? I included some information from Google below about it. We use Google Adwords for our pay per click advertising for lead generation,
    • zoho click, and nord VPN

      Unfortunately, we've been having problems with Zoho Click, where essentially the line cuts off after about a minute's worth of conversation every time we are on VPN. Is there a way we can change this within the settings so it does not cut the line off
    • Next Page