Function-28: Transfer record information from one module to another, based on specific criteria.

Function-28: Transfer record information from one module to another, based on specific criteria.



Welcome back everyone!

Last week, we learnt how to create activities automatically based on specific criteria. This week, let's look at a custom function that lets you transfer record information from one module to another, even for custom modules.

Business scenario:

Custom Modules enable you to create entire modules according to your requirements. You can also define the layout of the record in the module, set up layout rules, customize the fields of a record, set up hyperlinks and buttons, etc. This helps reduce clutter and organize your business information efficiently.

The custom function for today is quite similar to Lead Conversion. The difference is that it performs the conversion task on any modules. For instance, let's say you run a gaming company and have 2 custom modules, named Free Customers and Paid Customers. Set the custom function to automatically transfer the lead information to a record in the Free Customers module after making contact with the lead.

Create a Picklist named "Paid" with options "Yes" and "No". Tie the custom function I'm sharing today to this Picklist - I"ll tell you how to do it - such that the custom function gets invoked if "Yes" is picked. Set the default value to be "No" and leave the record as is if the customer prefers using the free plan. However, if the customer agrees to upgrade to paid plan, update the Picklist as "Yes". This invokes the custom function and moves the record to the Paid Customers module.This takes your business process automation taken to a whole new level.

Include this custom function in a Workflow Rule by setting the condition as "This workflow will be executed whenever the field Paid is updated." Alternatively, set a Custom Button to execute this custom function upon click.

Getting started with the custom function:

Step 1: From Leads to a Custom Module

  • Go to Setup > Automations > Actions > Custom Functions > Configure Custom Function > Write your own.
  • Provide a name for the custom function. For example: “Business Automation - 1”. Add a description(optional).
  • Select the module as Deal. Add a description (optional).
  • Click “Free flow scripting”.
  • Copy the code given below.
  • Click “Edit arguments”.
  • Enter the name as “leadId” and select the value as “Lead Id”.
  • Save the changes.
The script:

Code for Version 2.0 API:

leadIdLong = input.leadId.toLong();
leadDetails = zoho.crm.getRecordById("Leads",leadIdLong);
mp = map();
mp.put("Name",ifnull(leadDetails.get("Full_Name"),""));
mp.put("Annual_Revenue", ifnull(leadDetails.get("Annual_Revenue"),""));
mp.put("Billing_City", ifnull(leadDetails.get("City"),""));
mp.put("Billing_Country", ifnull(leadDetails.get("Country"),""));
mp.put("Description", ifnull(leadDetails.get("Description"),""));
mp.put("Fax", ifnull(leadDetails.get("Fax"),""));
mp.put("Industry", ifnull(leadDetails.get("Industry"),""));
mp.put("Employees", ifnull(leadDetails.get("No_of_Employees"),""));
mp.put("Phone", ifnull(leadDetails.get("Phone"),""));
mp.put("Rating", ifnull(leadDetails.get("Rating"),""));
mp.put("Billing_State", ifnull(leadDetails.get("State"),""));
mp.put("Billing_Street", ifnull(leadDetails.get("Street"),""));
mp.put("Billing_Code", ifnull(leadDetails.get("Zip_Code"),""));
mp.put("Website", ifnull(leadDetails.get("Website"),""));
create = zoho.crm.create("CustomModule1apiname", mp);
info mp;
info create;

Note : Replace 'CustomModule1apiname' with the custommodule's api name.

Code for Version 1.0 API:

leadIdLong = input.leadId.toLong();
leadDetails = zoho.crm.getRecordById("Leads", leadIdLong);
name = ifnull(leadDetails.get("First Name"),"") + " " + ifnull(leadDetails.get("Last Name"),"") ;
mp = map();
mp.put(("CustomModule1 Name"),name );
mp.put("Annual Revenue", ifnull(leadDetails.get("Annual Revenue"),""));
mp.put("Billing City", ifnull(leadDetails.get("City"),""));
mp.put("Billing Country", ifnull(leadDetails.get("Country"),""));
mp.put("Description", ifnull(leadDetails.get("Description"),""));
mp.put("Fax", ifnull(leadDetails.get("Fax"),""));
mp.put("Industry", ifnull(leadDetails.get("Industry"),""));
mp.put("Employees", ifnull(leadDetails.get("No of Employees"),""));
mp.put("Phone", ifnull(leadDetails.get("Phone"),""));
mp.put("Rating", ifnull(leadDetails.get("Rating"),""));
mp.put("Billing State", ifnull(leadDetails.get("State"),""));
mp.put("Billing Street", ifnull(leadDetails.get("Street"),""));
mp.put("Billing Code", ifnull(leadDetails.get("Zip Code"),""));
mp.put("Website", ifnull(leadDetails.get("Website"),""));
create = zoho.crm.create(("CustomModule1"), mp);
info mp;
info create;


Step 2: From one Custom Module to another

  • Go to Setup > Automations > Actions > Custom Functions > Configure Custom Function > Write your own.
  • Provide a name for the custom function. For example: “Business Automation - 2”. Add a description(optional).
  • Select the Custom Module as the module. Add a description (optional).
  • Click “Free flow scripting”.
  • Copy the code given below.
  • Click “Edit arguments”.
  • Enter the name as “CustommoduleId” and select the value as “CustomModule Id”.
  • Save the changes.

The script:

Code for Version 2.0 API:

CustommoduleDetails = zoho.crm.getRecordById("CustomModule1apiname", input.CustommoduleId.toLong());
createMap = map();
createMap.put("Name", ifnull(CustommoduleDetails.get("Name"),""));
createMap.put("Owner", ifnull(CustommoduleDetails.get("Owner"),"").get("id"));
createMap.put("Phone", ifnull(CustommoduleDetails.get("Phone"),""));
createMap.put("Email", ifnull(CustommoduleDetails.get("Email"),""));
createCustomModule = zoho.crm.create("CustomModule2apiname", createMap);
info createMap;
info createCustomModule;

Note : Replace 'CustomModule1apiname' with the custommodule1's api name.
Replace 'CustomModule2apiname' with the custommodule2's api name.

Code for Version 1.0 API:

CustommoduleDetails = zoho.crm.getRecordById("CustomModule1", input.CustommoduleId);
createMap = map();
createMap.put("CustomModule2 Name", ifnull(CustommoduleDetails.get("CustomModule1 Name"),""));
createMap.put("SMOWNERID", ifnull(CustommoduleDetails.get("SMOWNERID"),""));
createMap.put("Phone", ifnull(CustommoduleDetails.get("Phone"),""));
createMap.put("Email", ifnull(CustommoduleDetails.get("Email"),""));
createCustomModule = zoho.crm.create("CustomModule2", createMap);
info createMap;
info createCustomModule;

Adding to a workflow:
  • Go to Setup > Automation > Workflow Rules.
  • Click '+ Create Rule'.
  • Select the Module for which this custom function has to be added and give it a name and a description(optional).
  • Select "On a record action".
  • Select "Field Update" and click on Next.
  • Select the Condition as "Paid".
  • Select the checkbox "Repeat this workflow whenever a record is edited." and Click Next.
  • Choose "Custom Function" from Instant Actions.
  • Select the option "Custom Function" (Created by users from your organization).
  • Select the custom function you just added and click on Configure.
  • Click on "Save and Associate".
  • Save the workflow.

Note:

  • Use the code to transfer information between any two modules. Update the module names in the code accordingly.
  • Similar to "ID" of a record, the "ID" for a Custom Module is "CustomModule1", "CustomModule2", etc, in the order of creation. For instance, if Free Customers is created first and Paid Customers is second. Then ID of Free and Paid Customers is CustomModule1 and CustomModule2 respectively.
  • Create a Custom Field in the 1st module named "Date Created", or any name for that matter. It helps you to keep track of when you made contact with the customer, rather than the date in which the record in the 2nd module was created, which leads to discrepancies. Since the 2 modules are the same, creating this custom field lets you to know when the customer was contacted and when he turned into a "Paid Customer".

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.

    Access your files securely from anywhere











                            Zoho Developer Community





                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts



                                                            • Sticky Posts

                                                            • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

                                                              Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
                                                            • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

                                                              Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
                                                            • Custom Function : Automatically send the Quote to the related contact

                                                              Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
                                                            • Function #50: Schedule Calls to records

                                                              Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. 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
                                                            • Function #37: Create a Purchase Order from a Quote

                                                              Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ




                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Enable / show scroll bar when Mega Menu is opened

                                                                                                              Hey there I am using the mega menu add-on and experience a "flicker" whenever the mega menu opens. The reason is, that the scrollbar, which has a width of a few pixels, stops showing when the mega menu opens. As the scrollbar disappears the whole page
                                                                                                            • Restore lost Invoice!

                                                                                                              Some time ago I tried to Upgrade from Invoice to Books. I not upgraded and staid n Invoice. Now i tried again and first i deleted the old trial of books. But now all is gone, PLEASE HELP!! i have no backup and i have to have at least 7 years data retention by law. 
                                                                                                            • Zoho Desk Down

                                                                                                              Not loading
                                                                                                            • lookup and integrated forms

                                                                                                              I might be misunderstanding things but I wanted to integrate our zoho crm contacts into creator. I imagined that when I used the integration it would mirror into creator. It did brilliant. BUT We have a ticket form in creator that we want to use a lookup
                                                                                                            • Partially receive PO without partial Bill?

                                                                                                              Most of our inventory is pre-paid. Let's say we purchase 30 pieces of 3 different items for a total of 90 pieces. It is common for our supplier to send us the items as they are ready. So we will receive 30 pieces at a time. How can I partially receive
                                                                                                            • 2 users editing the same record - loose changes

                                                                                                              Hello, I'm very new to Zoho so apology if this has been addressed somewhere i can't find. I have noticed the following: If we have 2 users put an inventory item in edit mode at the same time: say user1 click on edit and user2 while user1 is still in edit,
                                                                                                            • How to get the Dashboard page to be the first page when you open the app

                                                                                                              So when it opens on a tablet or phone it opens on the welcome page, thanks.
                                                                                                            • How I set default email addresses for Sales Orders and Invoices

                                                                                                              I have customers that have different departments that handle Sales Orders and Invoices. How can i set a default email for Sales Orders that's different than the default email for Invoices? Is there a way I can automate this using the Contact Persons Departments
                                                                                                            • Adding hyperlinks in CRM emails time automatically

                                                                                                              It may just be me, but when I am writing an email to a lead, I find inserting a hyperlink very time consuming. Granted, I can use templates but there are a ton of scenarios where I might want to put a link in to an website that wouldnt require me to go though the effort of creating a template.  Ideally, the crm would identify that I that a string of text is a URL and insert the hyperlink automatically, just like microsoft outlook or gmail. Has anyone else had this same experience and found a way
                                                                                                            • Notes Attachments

                                                                                                              Two things it would be nice to have the attachment size the same as the attachments sections and it would be nice to be able to attach links like you can in the attachments section. Thank you
                                                                                                            • Zoho Sheet - Desktop App or Offline

                                                                                                              Since Zoho Docs is now available as a desktop app and offline, when is a realistic ETA for Sheet to have the same functionality?I am surprised this was not laucned at the same time as Docs.
                                                                                                            • Formula fields not refreshing until page is reloaded

                                                                                                              I need help/advice about the formula fields and how I can refresh the information in real-time. We have two formula fields on our deals page which show calculated prices: One formula is in a subform which calculates the subform total + 1 other field amount
                                                                                                            • How can I setup Zoho MCP with Chat GPT

                                                                                                              I can set up custom connections with Chat GPT but I cat an error when I try to set it up. The error is: "This MCP server can't be used by ChatGPT to search information because it doesn't implement our specification: search action not found" Thoughts?
                                                                                                            • Export Invoices to XML file

                                                                                                              Namaste! ZOHO suite of Apps is awesome and we as Partner, would like to use and implement the app´s from the Financial suite like ZOHO Invoice, but, in Portugal, we can only use certified Invoice Software and for this reason, we need to develop/customize on top of ZOHO Invoice to create an XML file with specific information and after this, go to the government and certified the software. As soon as we have for example, ZOHO CRM integrated with ZOHO Invoice up and running, our business opportunities
                                                                                                            • API ZOHO CRM Picket list with wrong values

                                                                                                              I am using Zoho API v.8. with python to create records in a custom module named "Veranstaltung" in this custom module I've got a picket list called "Email_Template" with 28 Values. I've added 8 new values yesterday, but if I try to use on of those values
                                                                                                            • Group Emails

                                                                                                              I have synced Zoho CRM to Campaigns but there are certain email not synced. showing it is Group Emails, but this email ids belongs to different individuals. please provide a solution as i nedd to sync the same.
                                                                                                            • Enable Password Import option in ulaa browser

                                                                                                              Dear Ulaa Team, I noticed that the Ulaa Password Manager currently offers an option to export passwords, but not to import them. This limitation poses a challenge for users like me who have stored numerous credentials in browsers like Chrome. Manually
                                                                                                            • "Is Zoho CRM customer" vs "Is linked with Zoho CRM"

                                                                                                              Recently while building a Flow, I was setting up a Decision action following a Zoho Invoice Fetch record action. There were 2 choices that I had not seen as something I could manually action in Zoho Invoice: "Is Zoho CRM customer" and "Is linked with
                                                                                                            • Client Script | Update #13 - Introducing ZRC: Simplified HTTP request library

                                                                                                              Hello Developers! Are you tired of juggling different methods to make API calls? Are you confused with multiple syntaxes and version restrictions? Have you ever wished for one simple way to make all API calls in CRM? We heard you :) Here comes ZRC (Zoho
                                                                                                            • Selection Filed for Data Export section

                                                                                                              Hi FSM Team, I hope you are all doing well. I would like to share an idea for future development based on my experience. Currently, in FSM, we can only download up to 5,000 records at a time. If the development team could add a selection option to choose
                                                                                                            • Text wrap column headers in reports?

                                                                                                              Is it possible to auto wrap column headers so that a longer multi-word header displays as two lines when the column is narrower than the width of the header title?
                                                                                                            • What if I dont see contacts on the left side list

                                                                                                              My CRM does not show the contacts tab. In order to create list this is needed and I cant find it.
                                                                                                            • Comments Vs. Replies

                                                                                                              I'm curious as to the difference between a "Reply" and a "Comment" on a ticket. It appears that "Replies" are what's used to determine response time SLA's and there are also used to automatically re-open tickets. I'm just trying to understand the key differences so I can educate both our clientele and our back-end users on which function/feature to use to better improve the ticket lifecycle. If anyone has any insight it would be appreciated. Thanks!
                                                                                                            • Transitioning to API Credits in Zoho Desk

                                                                                                              At Zoho Desk, we’re always looking for ways to help keep your business operations running smoothly. This includes empowering teams that rely on APIs for essential integrations, functions and extensions. We’ve reimagined how API usage is measured to give
                                                                                                            • Add Custom Reports To Dashboard or Home Tab

                                                                                                              Hi there, I think it would be great to be able to add our custom reports to the Home Tab or Dashboards. Thanks! Chad
                                                                                                            • Resetting auto-number on new year

                                                                                                              Hi everyone! We have an auto-number with prefix "D{YYYY}-", it generates numbers like D2025-1, D2025-2, etc... How can we have it auto-reset at the beginning of the next year, so that it goes to D2026-1? Thanks!
                                                                                                            • Microsoft Phone Link

                                                                                                              Does anyone know if you can use Microsoft Phone Link to make calls through Zoho?
                                                                                                            • Voip Phone system that integrates with Zoho

                                                                                                              Just checking to see if anyone could tell me what phone system they are using with Zoho that is on the list of systems that integrate with Zoho.  I use Vonage and have been with them for quite a few years but their service has really gone down hill and
                                                                                                            • Removing Related Modules Lookup Fields Assignment / Relationship

                                                                                                              Issue: When creating a related list, I accidently selected module itself creating a circle reference. See attached. Situation: I wish to relating a custom module called "Phone Calls" to Leads and Contacts. Outcome: 1) I either want to remove the this
                                                                                                            • [Product Update] TimeSheets module is now renamed as Time Logs in Zoho Projects.

                                                                                                              Dear Zoho Analytics customers, As part of the ongoing enhancements in Zoho Projects, the Timesheets module has been renamed to Time Logs. However, the module name will continue to be displayed as Timesheets in Zoho Analytics until the relevant APIs are
                                                                                                            • Kaizen #210 - Answering your Questions | Event Management System using ZDK CLI

                                                                                                              Hello Everyone, Welcome back to yet another post in the Kaizen Series! As you already may know, for the Kaizen #200 milestone, we asked for your feedback and many of you suggested topics for us to discuss. We have been writing on these topics over the
                                                                                                            • Can you prevent closing Ulaa window when the last tab is closed (inadvertently)?

                                                                                                              Most browsers have started to bring this feature in to prevent closing their windows when the last tab is closed (inadvertently). I hope Ulaa should get this in too.
                                                                                                            • Seriously - Create multiple contacts for leads, (With Company as lead) Zoho CRM

                                                                                                              In Zoho CRM, considering a comapny as a lead, you need us to allow addition of more than one contact. Currently the Lead Section is missing "Add contact" feature which is available in "Accounts". When you know that a particular lead can have multiple
                                                                                                            • can I link a contacts to multiple accounts

                                                                                                              can I link a contacts to multiple accounts
                                                                                                            • Rotate an Image in Workdrive Image Editor

                                                                                                              I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
                                                                                                            • Free webinar! Digitize recruitment and onboarding with Zoho Sign and Zoho Recruit

                                                                                                              Hello, Tired of being buried in onboarding paperwork? With the integration between Zoho Sign and Zoho Recruit, a powerful applicant tracking system, you can digitize and streamline the entire recruitment and onboarding process, all from one platform.
                                                                                                            • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

                                                                                                              so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
                                                                                                            • Open Activities view.

                                                                                                              I really like the new views for the open and closed activities inside the deals. But when you are in the tab view instead of the column view you can only complete and edit the open activity there isn't the 3 dot option to be able to delete the activ
                                                                                                            • Potentially Outdated and Vulnerable Chromium Engine Installed by Ulaa Browser Installer

                                                                                                              I just installed Ulaa Browser a few minutes ago. Whats My Browser page shows I am using an outdated Chromium engine meaning I might be vulnerable for security exploits that might have got fixed in the new version.
                                                                                                            • Potentially hardcoded list of Browsers to import from (after Ulaa Setup)

                                                                                                              I have just installed Ulaa Browser and found that the list of browser to import data is potentially hardcoded ones rather than looking at the system. I do not have FF, IE and Edge is not my default itself. I would appreciated if Ulaa detected my browsers
                                                                                                            • Next Page