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

    • Weekly Tips : Customize your Compose for a smoother workflow

      You are someone who sends a lot of emails, but half the sections in the composer just get in your way — like fields you never use or sections that clutter the space. You find yourself always hunting for the same few formatting tools, and the layout just
    • Custom Bulk Select Button

      Zoho CRM offers the ability to select multiple records and invoke a Custom Button This functionality is missing from Recruit Currently we can only add buttons in the detail page and list But we cannot select Multiple Records and invoke a function with
    • Need support in setting up the company email and few other setups

      Need support in setting up the company email and few other setups
    • Power of Automation :: Smart Ticket Management Between Zoho Desk and Projects

      Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
    • Need to set workflow or journey wait time (time delay) in minutes, not hours

      Minimum wait time for both Campaigns workflows and Marketing Automation journeys is one hour. I need one or the other to be set to several minutes (fraction of the hour). I tried to solve this by entering a fraction but the wait time data type is an integer
    • Remote Server is misconfigured

      Dear Team, I am unable to use email id as remote server is misconfigured. It would be really great if you could help on this and get this resolved. Thanks & Regard Rohit Gupta
    • BUG - Google Business Buttons - Add a button to GBP Post

      I am experiencing an issue with the "Add a button" feature when creating posts for my Google Business Profile (GBP) through Zoho Social. When I schedule or publish a GBP post and include a call-to-action button with a specific URL, the post itself publishes
    • This mobile number has been marked spam.

      Dear zoho team, I am very happy to use zoho,because it india 🇮🇳 own app, but when we login into zoho account we facing some issue, please solve below issue ASAP. Add your mobile number As an added security measure for Accounts, you need to verify and
    • Do you have software like Windows software?

      We want swadeshi software
    • Support for Custom Fonts in Zoho Recruit Career Site and Candidate Portal

      Dear Zoho Recruit Team, I hope you're doing well. We would like to request the ability to use custom fonts in the Zoho Recruit Career Site and Candidate Portal. Currently only the default fonts (Roboto, Lato, and Montserrat) are available. While these
    • Trying to export a report to Excel via a deluge script

      I have this code from other posts but it gives me an error of improper statement, due to missing ; at end of line or incomplete expression. Tried lots of variations to no avail. openUrl(https://creatorapp.zoho.com/<username>/<app name>/XLSX/#Report:<reportname>,"same
    • Need help to create a attach file api

      https://www.zoho.com/crm/developer/docs/api/v8/upload-attachment.html Please help me to create it... It's not working for while. Do you have some example?
    • Export view via deluge.

      Hi, Is it possible to export a view (as a spreadsheet) via deluge? I would like to be able to export a view as a spreadsheet when a user clicks a button. Thanks     
    • Zoho Inventory's latest shipping integration updates at a glance.

      Hello Users, We would like to share some important news about our latest improvements in the Shipping integration capabilities of Zoho Inventory that we achieved in 2024 with some of our major integration partners in key editions across APAC, North America,
    • IP Address Blocked

      Hi Team. Hope you're doing good. I'm unable to access Zoho with my IP address. I have to use VPN to access it. IP: 39.44.12.153 This is happening with all the Zoho products, the admin console and the mail.
    • Outdated state in mexico

      Hello Zoho team, the drop down to add the state for customers, when they introduce their state in mexico has a city named “Distrito Federal” that name changed many years ago to “ciudad de mexico”. could you please update this so my clients can find the
    • Possible to generate/download Quote PDF using REST API?

      See title. Is there any way after a quote has been created to export to a PDF using a specified template and then download it? Seems like something that should be doable. Is this not supported in the API v2.0?
    • Creating an invoice to be paid in two installments?

      Hi there, I own a small Photographic Services business and have not been able to find a way to fit my billing system into Zoho, or any other Accounting software. The way my payments work is: 1. Customer pays 50% of total price of service to secure their
    • Bug in allowing the user to buy out of stock items

      Hi i want to allow the user to buy out of stock items, according to the commerce documentation if i disable Restrict "Out of stock" purchases it will, but it doesnt work, so i want to know if it had any relation with zoho inventory, and if theres any
    • Replace Lookup fields ID value with their actual name and adding inormation from subforms

      Hi everyone,  I wanted to see if someone smarter than me has managed to find any solutions to two problems we have. I will explain both below.  To start we are syncing data from Zoho CRM to Zoho Analytics and I will use the Sales Order module when giving
    • Can a Zoho Sites page be embedded into another website (outside Zoho)

      Hi All, We have a request from a client - they'd like to take one of our information pages created in Zoho Sites and embed it into their own website? I was told through an email with Zoho that this was possible >>Thank you for your patience regarding
    • Bug in allowing the user to buy out of stock items

      Hi i want to allow the user to buy out of stock items, according to the commerce documentation if i disable Restrict "Out of stock" purchases it will, but it doesnt work, so i want to know if it had any relation with zoho inventory, and if theres any
    • Transition Criteria Appearing on Blueprint Transitions

      On Monday, Sept. 8th, the Transition criteria started appearing on our Blueprints when users hover over a Transition button. See image. We contacted Zoho support because it's confusing our users (there's really no reason for them to see it), but we haven't
    • Zoho CRM Sales Targets for Individual Salespeople

      Our organistion has salespeople that are allocated to different regions and have different annual sales targets as a result. I am building an CRM analytics dashboard for the sales team, which will display a target meter for the logged in salesperson.
    • Transfer all Related Data to new Account Owner

      Currently when I change the account Owner I only see the option to change only the open deals But I want the new account owner to take over all the related modules and all the deal stages Is it not possible right now? Am I missing something? Do I really
    • Can i connect 2 instagram accounts to 1 brand?

      Can i connect 2 instagram accounts to 1 brand? Or Do i need to create 2 brands for that? also under what subscription package will this apply?
    • Add an external email to the allowed list

      I need to allow an external email to raise a ticket on Manage Engine ServiceDesk Plus. The external email is a outside of our domain and is not a domain user. The email address that needs to be allowed to raise a ticket request is noreply@formsatack.com.
    • How to Calculate MTTR (Mean Time to Resolve)

      We want to calculate MTTR (Mean Time to Resolve) in our Zoho Analytics report under Tickets. Currently, we are using the following fields: Ticket ID Ticket Created Time Ticket Closed Time Ticket On Hold Time We are planning to calculate MTTR (in days)
    • How to export project tasks, including the comments

      Hi, how can I export the project tasks, whereby I can also see the comments associated to a specific task? The use-case is that often we use comments to discuss or update a task related ideas. I would like to export the tasks, where we can also see the
    • Unable to see Zoho contacts in Zoho app on ios

      Hi Support Team, I am a new user, I have created my account and installed zohomail app on iOS 16 which works. I was also able to import my Gmail contacts into Zoho Contacts, which I can see. The problem is that I can’t see these imported cobalts in Zohomail
    • Does Zoho Sheet Supports https://n8n.io ?

      Does Zoho Sheet Supports https://n8n.io ? If not, can we take this as an idea and deploy in future please? Thanks
    • Bigin Android app update: User management

      Hello everyone! In the most recent Bigin Android app update, we have brought in support for the 'Users and Controls' section. You can now manage the users in your organization within the mobile app. There are three tabs in the 'Users and Controls' section:
    • Share records with your customers and let them track their statuses in real time.

      Greetings, I hope everyone is doing well! We're excited to introduce the external sharing feature for pipeline records. This new enhancement enables you to share pipeline records with your customers via a shareable link and thereby track the status of
    • Live webinar: Discover Zoho Show: A complete walkthrough

      Hello everyone, We’re excited to invite you to our upcoming live webinar, Discover Zoho Show: A Complete Walkthrough. Whether you’re just getting started with Show or eager to explore advanced capabilities, this session will show you useful tips and features
    • Deal Stage component/widget/whatever it is... event

      Deal Stages I am trying to access the event and value of this component. I can do it by changing the Stage field but users can also change a Deal Stage via this component and I need to be able to capture both values. Clicking on 'Verbal' for instance,
    • Create advanced slideshows with hybrid reports using Zoho Projects Plus

      Are your quarterly meetings coming up? It’s time to pull up metrics, generate reports, and juggle between slides yet again. While this may be easier for smaller projects, large organizations that run multiple projects may experience the pressure when
    • Add an option to disable ZIA suggestions

      Currently, ZIA in Zoho Inventory automatically provides suggestions, such as sending order confirmation emails. However, there is no way to disable this feature. In our case, orders are automatically created by customers, and we’ve built a custom workflow
    • Formula field with IF statement based on picklist field and string output to copy/paste in multi-line field via function

      Hello there, I am working on a formula field based on a 3-item picklist field (i.e. *empty value*, 'Progress payment', 'Letter of credit'). Depending on the picked item, the formula field shall give a specific multi-line string (say 'XXX' in case of 'Progress
    • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

      Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
    • Zoho CRMの流入元について

      Zoho CRMとZoho formsを連携し、 formsで作成したフォームをサイトに埋め込み運用中です。 UTMパラメータの取得をformsを行い、Zoho CRMの見込み客タブにカスタム項目で反映される状況になっています。 広告に関してはUTMパラメータで取得できているため問題ないのですが、オーガニック流入でフォーム送信の場合も計測したいです。メールやGoogle、Yahoo、directなどの流入元のチャネルが反映されるようにしたいのですが、どのように設定したら良いでしょうか。 また、
    • Next Page