Function-26: Update information between two modules via Lookup fields.

Function-26: Update information between two modules via Lookup fields.




Welcome back everyone!

Last week, we learnt how to populate the Amount field in a Deal by calculating the number of products and its unit price. This week, let's look at a custom function that updates information between two modules via Lookup fields.

Business scenario:

Quotes are binding agreements between a customer and a vendor, to deliver the requested products to the customer within a specified time-frame at a predefined price. Your customers can place orders within a stipulated period (validity date) that has been mentioned in the quote, otherwise you may cancel or extend the time-frame by sending a new quote. In general, a Quote contains the Quote Number, Date, Line Items(Products) inclusive of quantity and prices based on your Price Books, Terms & Conditions and Description.

And incidently, the quote can be sent to a specific Contact or an Account. Depending on the scenario, the information to be on the quote may differ. For instance, you may want to add the Contact Phone number, Email address, Description or any information in a custom field to the quote. The Quotes module indeed has a lookup field for Contact, Deal and Account. Meaning, the information from a Contact, Deal or an Account can be copied automatically to a Quote through the lookup. So where does this custom function fit in?

It's for the information fields which are not available in a Quote. Information which is not normally available to be stored in the CRM can be stored using a custom field. Similarly, the modules Quotes, Invoice and modules like that have to be updated to store that additional information too. Are you going to juggle between modules to copy each additional information when a lookup is already available?

The custom function for today latches on to the Lookup field and whenever a Contact is selected as a lookup, the custom fields specified in the custom function are also transferred automatically. Furthermore, this custom function is not limited to the Quotes module. You can use this function to any module that has a Lookup field.

Getting started with the custom function:

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

The script:

Code for Version 2.0 API:

contDetails = zoho.crm.getRecordById("Contacts", input.contId.toLong());
mp=map();
mp.put("First_Name",ifnull(contDetails.get("First_Name"),""));
mp.put("Last_Name",ifnull(contDetails.get("Last_Name"),""));
mp.put("Broker_First_Name",ifnull(contDetails.get("Broker_First_Name"),""));
mp.put("Broker_Last_Name",ifnull(contDetails.get("Broker_Last_Name"),""));
mp.put("Property_Street",ifnull(contDetails.get("Property_Street"),""));
mp.put("Property_City",ifnull(contDetails.get("Property_City"),""));
mp.put("Property_State",ifnull(contDetails.get("Property_State"),""));
mp.put("Property_Zip",ifnull(contDetails.get("Property_Zip"),""));
updateResp= zoho.crm.update("Quotes",input.quoteId.toLong(), mp);
info mp;
info updateResp; 

Code for Version 1.0 API:

quoteIdStr = input.quoteId.toString();
contDetails = zoho.crm.getRecordById("Contacts", input.contId);
mp=map();
mp.put("First Name",ifnull(contDetails.get("First Name"),""));
mp.put("Last Name",ifnull(contDetails.get("Last Name"),""));
mp.put("Broker First Name",ifnull(contDetails.get("Broker First Name"),""));
mp.put("Broker Last Name",ifnull(contDetails.get("Broker Last Name"),""));
mp.put("Property Street",ifnull(contDetails.get("Property Street"),""));
mp.put("Property City",ifnull(contDetails.get("Property City"),""));
mp.put("Property State",ifnull(contDetails.get("Property State"),""));
mp.put("Property Zip",ifnull(contDetails.get("Property Zip"),""));
updateResp= zoho.crm.updateRecord("Quotes", quoteIdStr, mp);
info mp;
info updateResp;

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 "Create or Edit" in the "When do you want to execute this rule?".
  • Select the Condition as "All Records" and click Next.
  • Choose "Custom Function" from Instant Actions.
  • Select the option "Custom Function" (Created by users from your organization).
  • Select the required custom function and click Publish.
  • Provide a Description for the custom function and Publish it.
  • Save the workflow.

Note:

  • You can use the code on any module. Change the name of the module from 'Quotes' to whichever module you prefer and update the code accordingly.
  • The Fields in the left section (right after mp.put) of the code are the destination fields and the ones in the right are the source fields. Update your code according to your requirement and your fields.
  • If there is a need to copy information from a custom field, you need to create that custom field for the destination module too.

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

                                                                                                            • Can't View Project Names in Mobile App

                                                                                                              I can't view project names on PO's in the app, nor can I add that as a viewable PDF field in inventory on the computer. I've attached screenshots showing that in the mobile version whether you are on the PO, editing the PO, or viewing the PO line items,
                                                                                                            • How do you print a refund check to customer?

                                                                                                              Maybe this is a dumb question, but how does anyone print a refund check to a customer? We cant find anywhere to either just print a check and pick a customer, or where to do so from a credit note.
                                                                                                            • Notebook

                                                                                                              I have purchased the monthly pro subscription of Notebook. But it does not support my XP-Pen to write something in it. So it is not useful to me. Hence I am requesting you to help me to discontinue this subscription.
                                                                                                            • Domain Mapping & Image Publishing Issues on Zoho Sites

                                                                                                              Hello, I am facing two issues with my Zoho Sites account: 1. Images not visible after publishing. 2. Domain mapping error: "Domain already exists". I am a paid customer. Please connect me with Live Chat Support or Zoho Assist so I can show my issue
                                                                                                            • Prevent duplicate with custom fields?

                                                                                                              I was wondering something about custom field/custom modules in Zoho Desk. For some reason you can make a custom field mandatory but not unique? For example, if I create a custom module to manage equipment and renewal and make a field serial number no
                                                                                                            • Two currencies

                                                                                                              More and more I am finding that internattional payments' fees are unpredictable. I would like, on my invoices that are in a foreign currency (eg. USD$ or EUR€) for there to be a GBP£ TOTAL display alongside the invoice's currency total. This would make
                                                                                                            • Generate leads from instagram

                                                                                                              hello i have question. If connect instagram using zoho social, it is possible to get lead from instagram? example if someone send me direct message or comment on my post and then they generate to lead
                                                                                                            • Where is the desktop app for Zoho Projects???

                                                                                                              As a project manager, I need a desktop app for the projects I manage. Yes, there's the web app, which is AWESOME for cross browser and platform compatibility... but I need a real desktop app for Projects that allow me to enter offline information where
                                                                                                            • White Label certificate

                                                                                                              Hi all, About 72 hours ago, we fulfilled all steps for white labeling (CNAME to point to mail.cs.zohohost.eu), but since then the configuration page is now stuck at "generating certificate" since 3 days. When I execute an NSLOOKUP mail.webfoundry.be it
                                                                                                            • How to Automate Monthly PDF Reports with Filters in Zoho Creator

                                                                                                              Hi everyone, I’m trying to build an automated monthly reporting process in Zoho Creator and would appreciate suggestions or best practices from anyone who has done something similar. What I’m trying to do: I have a form called New_Customer with fields
                                                                                                            • Feedback: Streamlining Note Management in Zoho Notebook

                                                                                                              Dear Team/Support, I would like to share some feedback regarding the note management system that could help improve usability and accessibility for users like myself. Notebook 1 (screenshot attached): Currently, the system does not allow selecting and
                                                                                                            • showing Limit exceeded

                                                                                                              Good afternoon...trust you're good. I've been having issues working with but it's not responding. it's showing Limit exceeded, sorry it seems like too many people are working on the sheet right now please try again later. meanwhile no one is working on
                                                                                                            • Sorting columns in Zoho Projects

                                                                                                              Hi, In project management best practice, sorting columns (ascending, descending) is an important tool. Sorting dates to see the order of tasks starting, sorting on priority or even on planned hours is a must for an efficient project control. Currently,
                                                                                                            • Upload API

                                                                                                              I'm trying to use the Upload API to upload some images and attach them to comments (https://desk.zoho.com/DeskAPIDocument#Uploads#Uploads_Uploadfile) - however I can only ever get a 401 or bad request back. I'm using an OAuth token with the Desk.tickets.ALL
                                                                                                            • Losing description after merging tickets

                                                                                                              Hello, We merge tickets when they are about the same topic from the same client. It happens sometimes. We recently noticed that after the merger only the description from the master ticket is left in a thread. And the slave-ticket description is erased.
                                                                                                            • update linked contacts when update happens in account

                                                                                                              Hi, I have a custom field called Licence in the Accounts module. When someone buys a licence, I’d like to update a custom field in the related Contacts. How can I achieve this? I noticed that workflows triggered on Accounts only allow me to update fields
                                                                                                            • Problem Management Module

                                                                                                              I am looking for a Problem Management module within Zoho Desk. I saw in some training videos that this is available, and some even provided an annual price for it. I want an official confirmation on whether this is indeed available. This is not a particularly
                                                                                                            • Unable to explore desk.zoho.com

                                                                                                              Greetings, I have an account with zoho which already has a survey subscription. I would like to explore desk.zoho.com, but when I visit it while logged in (https://desk.zoho.com/agent?action=CreatePortal) I just get a blank page. I have tried different
                                                                                                            • Offline support for mobile app

                                                                                                              Accessing your files and folders from your mobile devices is now quicker and simpler, thanks to the power of offline support. Whether on an Android or iOS device, you can use the Offline function to save files and folders, so you can review them even
                                                                                                            • Zoho Desk KB article embedded on another site.

                                                                                                              We embed KB articles from Zoho Desk on another site (our application). When opening the article in a new tab, there is no issue, but if we choose lightbox, we are getting an error "To protect your security, help.ourdomain.com will not allow Firefox to
                                                                                                            • OPTED FOR STORAGE BY DESCRIPTIVE MISGUIDANCE

                                                                                                              We've opened a domain with three mail ids and payment has also been processed now the bill raised is for single use ID with additional storage capacity. Kindly request you to modify the purchase.
                                                                                                            • List of packaged components and if they are upgradable

                                                                                                              Hello, In reference to the article Components and Packaging in Zoho Vertical Studio, can you provide an overview of what these are. Can you also please provide a list of of components that are considered Packaged and also whether they are Upgradable?
                                                                                                            • Does Attari Messaging app have Bot option and APIB

                                                                                                              Hi, Does Attari also have Bot and API as we use in WhatsApp??
                                                                                                            • How to add application logo

                                                                                                              I'm creating an application which i do not want it to show my organization logo so i have changed the setting but i cannot find where to upload/select the logo i wish to use for my application. I have seen something online about using Deluge and writing
                                                                                                            • Email login error

                                                                                                              Login successfully but email page error
                                                                                                            • Zoho Analytics Regex Support

                                                                                                              When can we expect full regex support in Zoho Analytics SQL such as REGEXP_REPLACE? Sometimes I need to clean the data and using regex functions is the easiest way to achieve this.
                                                                                                            • Change of Blog Author

                                                                                                              Hi, I am creating the blog post on behalf of my colleague. When I publish the post, it is showing my name as author of the post which is not intended and needs to be changed to my colleague's name. How can I change the name of the author in the blogs?? Thanks, Ramanan
                                                                                                            • Show Attachments in the customer portal

                                                                                                              Hi, is it possible to show the Attachments list in the portal for the particular module? Bests.
                                                                                                            • Feature Request - Insert URL Links in Folders

                                                                                                              I would love to see the ability to create simple URL links with titles in WorkDrive. or perhaps a WorkDrive extension to allow it. Example use case: A team is working on a project and there is project folder in WordDrive. The team uses LucidChart to create
                                                                                                            • How to sync from Zoho Projects into an existing Sprint in Zoho Sprints?

                                                                                                              Hi I have managed to integrate Zoho Projects with Zoho Sprints and I can see that the integration works as a project was created in Zoho Sprints. But, what I would like to do is to sync into an existing Zoho Sprints project. Is there a way to make that
                                                                                                            • how to differentiate if whatsapp comes from certain landing page?

                                                                                                              I create a Zobot in SalesIQ to create a Whatsapp bot to capture the lead. I have 2 landing pages, one is SEO optimized and the other want is optimized for leads comes from Google Ads. I want to know from which landing page this lead came through WhatsApp
                                                                                                            • Split my account

                                                                                                              Hello, I recently bought an email service for a friend. But, looks like I used my personal account to buy the plan. Please split the account so that the email service stays in a different account than my personal account.
                                                                                                            • How to record company set up fees?

                                                                                                              Hi all, We are starting out our company in Australia and would appreciate any help with setting up Books accounts. We paid an accountant to do company registration, TFN, company constitution, etc. I heard these all can be recorded as Incorporation Costs, which is an intangible asset account, and amortised over 5 years. Is this the correct way to do it under the current Australian tax regulations? How and when exactly should I record the initial entry and each year's amortasation in Books? Generally
                                                                                                            • Have Mail Lite, wish to add/purchase 2nd domain and use email

                                                                                                              Hello, I have recently created two new businesses. I have successfully used Zoho to create a domain for one business and have set up two email addresses / users on that domain. I am trying to figure out how to create a second domain, just like I did the
                                                                                                            • Show Payment terms in Estimates

                                                                                                              Hi,  we are trying to set up that estimates automatically relates payment terms for the payment terms we introduced on Edit contact (Field Payment terms).  How can it be done? Our aim is to avoid problems on payment terms introduced and do not need to introduce it manually on each client (for the moment we are introducing this information on Terms and Conditions.  Kind Regards, 
                                                                                                            • Search Bar Improvement for Zoho Commerce

                                                                                                              Hey everyone, I've been using Zoho Commerce for a bit now, and I think the search bar could really use an upgrade. Right now, it doesn't show products in a dropdown as you type, which would make finding items a lot faster. On Shopify, for example, you
                                                                                                            • How can I calculate the physical stock available for sale?

                                                                                                              Hey Zoho Team,  I've tried to calculate the physical stock on hand in various ways - but always receive a mismatch between what's displayed in Zoho Inventory & analytics.  Can you please let me know how the physical stock available for sale is calculated?
                                                                                                            • When dispatched to crew, assigning lead missing

                                                                                                              Hello, For the past two or three weeks, whenever an officer assigns Service Appointment to a team, the lead person is missing from the assigned service list. Therefore, we have to reschedule the SA and then the lead person becomes visible in the assigned
                                                                                                            • I want to transfer the project created in this account to another account

                                                                                                              Dear Sir I want to transfer the project created in one account to another account
                                                                                                            • Inactive User Auto Response

                                                                                                              We use Zoho One, and we have a couple employees that are no longer with us, but people are still attempting to email them. I'd like an autoresponder to let them no the person is no longer here, and how they can reach us going forward. I saw a similar
                                                                                                            • Next Page