Function-11: Turn a contact into a vendor.

Function-11: Turn a contact into a vendor.


Welcome back everyone! 

Last week, we learnt how toadd the international call prefix '+' and remove the alphbet from numeric fields. This week, let's look at a custom function that lets you turn a contact into a vendor with just the click of a button.

Business scenario:

The Vendors module in Zoho CRM facilitates efficient tracking of all vendor related details. It lets you create and associate vendor records with address, contacts, products, and such. We recommend this method for creating vendor records. However, what if you have a scenario where the vendor is already a part of your Leads/Contacts module via inbound communication? It is unproductive and redundant work to update Vendors module again for the records already updated.

Custom functions help you overcome this hurdle. It gives you the flexibility of replicating the details from the Leads/Contacts module to the Vendors module at the click of a button.

Getting started with the custom function:
  1. Go to Setup > Customization > Modules > Select the required module > Links and Buttons > +Create new button .
  2. Provide a name for the button. For example: “Create Vendor”. Add a description(optional).
  3. Choose View page from the drop-down list.
  4. Select Writing custom function from the subsequent drop-down.
  5. Provide a name for the custom function. Add a description(optional).
  6. Click “ Free flow scripting ”.
  7. Copy the code given below.
  8. Click “ Edit arguments ”.
  9. Enter the name as “ contactId ” and select the value as “ Contact Id ”.
  10. Save the changes.
  11. Click Save to create the button.

The script:

This example code is for creating a record in Vendors module from Contacts module. 

Code for Version 2.0 API:
 
contDetails = zoho.crm.getRecordById("Contacts", input.contactId.toLong()); 
fullname = ifnull(contDetails.get("Full_Name"),"");
name = "CLIENT : " + fullname;
mp = map();
mp.put("Vendor_Name", name);
mp.put("Phone", ifnull(contDetails.get("Mobile"),""));
mp.put("Email", ifnull(contDetails.get("Email"),""));
mp.put("Currency", ifnull(contDetails.get("Currency"),""));
mp.put("Street", ifnull(contDetails.get("Mailing_Street"),""));
mp.put("State", ifnull(contDetails.get("Mailing_State"),""));
mp.put("City", ifnull(contDetails.get("Mailing_City"),""));
mp.put("Zip_Code", ifnull(contDetails.get("Mailing_Zip"),""));
mp.put("Country", ifnull(contDetails.get("Mailing_Country"),""));
mp.put("Owner", "1234567890");
mp.put("Primary_Contact", ifnull(contDetails.get("id"),""));
create = zoho.crm.create("Vendors", mp);
info mp;
info create;
return "Vendor Created Successfully";

Code for Version 1.0 API:

contDetails = zoho.crm.getRecordById("Contacts", input.contactId.toLong());
first = ifnull(contDetails.get("First Name"),"");
last = ifnull(contDetails.get("Last Name"),"");
name = "CLIENT : " + first + " " + last;
mp = map();
mp.put("Vendor Name", name);
mp.put("Phone", ifnull(contDetails.get("Mobile"),""));
mp.put("Email", ifnull(contDetails.get("Email"),""));
mp.put("Currency", ifnull(contDetails.get("Currency"),""));
mp.put("Street", ifnull(contDetails.get("Mailing Street"),""));
mp.put("State", ifnull(contDetails.get("Mailing State"),""));
mp.put("City", ifnull(contDetails.get("Mailing City"),""));
mp.put("Zip Code", ifnull(contDetails.get("Mailing Zip"),""));
mp.put("Country", ifnull(contDetails.get("Mailing Country"),""));
mp.put("SMOWNERID", "1234567890");
mp.put("Primary Contact", ifnull(contDetails.get("CONTACTID"),""));
create = zoho.crm.create("Vendors", mp);
info mp;
info create;
return "Vendor Created Successfully";

Note:

  • This custom function creates a record in a module with the information from another module, reducing duplicate work and improving efficiency. 
  • Change the name of the module from 'Contacts' to the intended module name and update the code accordingly.

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 serieshere.

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

                                                            • 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,


                                                            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

                                                                                              Get Started. Write Away!

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

                                                                                                Zoho CRM コンテンツ




                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方







                                                                                                              • Recent Topics

                                                                                                              • Domain restriction for User Management actions in Zoho One

                                                                                                                Greetings, Zoho One Admins! To strengthen account security further and safeguard user management settings, we are imposing domain-based restrictions for user account-focused admin actions in Zoho One. In addition to password reset of user, organization
                                                                                                              • Zoho Mail iOS app update: Signature

                                                                                                                Hello everyone! In the latest version(3.1.7) of the Zoho Mail app update, we have brought in support to create, edit and remove signature within the app. You can create signature from the compose screen as well as from within the Settings module(inside
                                                                                                              • Copy paste from word document deletes random spaces

                                                                                                                Hello Dear Zoho Team, When copying from a word document into Notebook, often I face a problem of the program deleting random spaces between words, the document become terribly faulty, eventhough it is perfect in its original source document (and without
                                                                                                              • Zoho Mail iOS app update - RTL languages support and access emails using permalink and universal link, image upload resolution

                                                                                                                Hello everyone! In the most recent version of the Zoho Mail iOS app update, we have brought in support for RTL languages(Arabic and Urudu), providing a seamless reading experience with proper text alignment and layout throughout the app. We have also
                                                                                                              • Desktop app doesn't support notecards created on Android

                                                                                                                Hi, Does anybody have same problem? Some of last notecards created on Android app (v. 6.6) doesn't show in desktop app (v. 3.5.5). I see these note cards but whith they appear with exclamation mark in yellow triangle (see screenshot) and when I try to
                                                                                                              • Approval Button in Subform

                                                                                                                Hi Team, I’m working on a subform-based requirement where users will submit requests, and these requests must go through approval by multiple team managers. Each line item in the subform needs to be individually approved or declined based on the user's
                                                                                                              • Reporting Limitation on Lead–Product Relation in Zoho CRM

                                                                                                                I noticed that Zoho CRM has a default Products related list under Leads. However, when I try to create a report for Lead–Product association, I’m facing some limitations. To fix this, I’m considering adding a multi-lookup field along with a custom related
                                                                                                              • Zoho CRM for Everyone's NextGen UI Gets an Upgrade

                                                                                                                Hello Everyone We've made improvements to Zoho CRM for Everyone's Nextgen UI. These changes are the result of valuable feedback from you where we’ve focused on improving usability, providing wider screen space, and making navigation smoother so everything
                                                                                                              • Setting checkbox value on template in Sign from Creator

                                                                                                                Good day, Please help me understand how do I set a tick from a checkbox in Creator into a checkbox on a Sign template. Below is the only values on the Sign template and the code from Creator, "field_boolean_data": {}, "field_date_data": {}, "field_radio_data":
                                                                                                              • Zoho Projects - Unread Comment Icon

                                                                                                                Hi Projects Team, It would be great if there was a notification I con on the comments icon so it's easy to see which tasks have new comments. Something like a red circle with a number of unread comments would be great. Thanks for considering my feed
                                                                                                              • Zoho Projects - Update Feed via API

                                                                                                                Hi Projects Team, Please consider adding an API to allow update and retrieval of messages to the Feed. Thank you
                                                                                                              • Automated log-out/session end

                                                                                                                I'm concerned about security of our data. Is it possible to set an automatic time-out for user sessions on Zoho CRM, after a certain period of inactivity or when the session reaches a certain duration (12 hours perhaps)? 
                                                                                                              • Subform auto populate values

                                                                                                                Hi Team, I’m trying to retrieve values from Zoho People using API functions and dynamically populate them into a subform. For example, I’ve created a form with several fields that users will fill out. Based on their input, I need to fetch records from
                                                                                                              • What is New in CRM Functions?

                                                                                                                What is New in CRM Functions? Hello everyone! We're delighted to share that Functions in Zoho CRM have had a few upgrades that would happen in phases. Phase 1 An all new built-in editor for better user experience and ease of use. ETA: In a couple of days.
                                                                                                              • Gantt Chart - Zoho Analytics

                                                                                                                Are there any plans to add Gantt Charts capabilities to Zoho Analytics?
                                                                                                              • WhatsApp Calling Integration via Zoho Desk

                                                                                                                Dear Zoho Desk Team, I would like to request a feature that allows users to call WhatsApp numbers directly via Zoho Desk. This integration would enable sending and receiving calls to and from WhatsApp numbers over the internet, without the need for traditional
                                                                                                              • How to update Multi File upload field

                                                                                                                Assume that i have a multi file upload field,how can i update the same field again?
                                                                                                              • Request for Auto PO - Min–Max based Automated Purchase Feature

                                                                                                                Dear Zoho POS Team, I’m writing to request a feature enhancement that would significantly streamline inventory management for businesses using Zoho POS — particularly supermarkets, FMCG retail, and multi-store operations like ours. Feature Requested:
                                                                                                              • Presenting ABM for Zoho CRM: Expand and retain your customers with precision

                                                                                                                Picture this scenario: You're a growing SaaS company ready to launch a powerful business suite, and are looking to gain traction and momentum. But as a business with a tight budget, you know acquiring new customers is slow, expensive, and often delivers
                                                                                                              • Identify long running sync jobs/tables

                                                                                                                My sync process causes strain on my production database and I'd love some tools/alerts to help me identify which tables are taking the longest. The current screen only shows 3 tables at a time and truncates the last fetch time so that it is very cumbersome
                                                                                                              • 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.
                                                                                                              • Unusual activity detected from this IP. Please try again after some time

                                                                                                                When i try to create new addresses on my account i am getting this error, it has been 24 hours now and i am still getting this error can anyone help
                                                                                                              • Automatically CC an address using Zoho CRM Email Templates

                                                                                                                Hi all - have searched but can't see a definitive answer. We have built multiple email templates in CRM. Every time we send this we want it to CC a particular address (the same address for every email sent) so that it populates the reply back into our
                                                                                                              • Solution to Import PST File into Office 365.

                                                                                                                MailsDaddy OST to Office 365 Migration Tool is an outstanding solution to recover OST files and migrate them into Office 365 without any hassle. Using this software users can multiple OST files into Office 365 with complete data security. It offers users
                                                                                                              • Series Label in the Legend

                                                                                                                My legend reads 'Series 1' and 'Series 2'. From everything I read online, Zoho is supposed to change the data names if it's formatted correctly. I have the proper labels on the top of the columns and the right range selected. I assume it's something in
                                                                                                              • Associate emails from both primary and secondary contacts to deal

                                                                                                                We need to associate emails from multiple contacts to a deal. Please advise how this can be achieved. At present, only emails from primary contacts can be associated. Thanks
                                                                                                              • New integration: Zoho Sign for Zoho Projects

                                                                                                                Hey there! We’re excited to announce the brand-new Zoho Sign integration for Zoho Projects! With this integration, users can now send documents for signatures, track their progress, and manage approvals—all without leaving Zoho Projects. This bridges
                                                                                                              • Boosting efficiency through faster ticket rendering

                                                                                                                This enhancement will provide faster access for support teams and end-users, significantly boosting productivity for everyone. Get ready for a more efficient and satisfying experience! Immediate benefits Faster ticket rendering reduces wait times and
                                                                                                              • Narrative 15: Blueprint - Automate, guide, and transform your support processes

                                                                                                                Behind the scenes of a successful ticketing system: BTS Series Narrative 15: Blueprint - Automate, guide, and transform your support processes Even organizations that deliver quality products and services can face low customer satisfaction when their
                                                                                                              • Every rating counts: Shaping customer experience

                                                                                                                We are back to that beautiful time of the year. It is the season to reflect, be thankful, and appreciate everything that has happened throughout the year. Thanksgiving is a time we connect with our family, friends, and relatives to strengthen relationships,
                                                                                                              • Different MRP / Pricing for same product but different batches

                                                                                                                We often face the following situations where MRP of a particular product changes on every purchase and hence we have to charge the customer accordingly. This can't be solved by Batch tracking as of now so far as I understand Zoho. How do you manage it as of now? 
                                                                                                              • Batch/lot # and Storage bin location

                                                                                                                Hi I want to ask for a feature on Zoho inventory I own a warehouse and I've gone through different management software solutions with no luck until I found Zoho, it has been a game changer for my business with up to the minute information, I'm extremely happy with it. It's almost perfect. And I say Almost because the only thing missing for me (and I'm sure I'm not alone) is the need of being able to identify the lot number of my inventory and where it is located in the warehouse. Due to the nature
                                                                                                              • ZOHO BOOKS - RECEIVING MORE ITEMS THAN ORDERED

                                                                                                                Hello, When trying to enter a vendor's bill that contains items with bigger quantity than ordered in the PO (it happens quite often) - The system would not let us save the bill and show this error: "Quantity recorded cannot be more than quantity ordered." 
                                                                                                              • Good news! Calendar in Zoho CRM gets a face lift

                                                                                                                Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
                                                                                                              • Sync desktop folders instantly with WorkDrive TrueSync (Beta)

                                                                                                                Keeping your important files backed up and accessible has never been easier! With WorkDrive desktop app (TrueSync), you can now automatically sync specific desktop folders to WorkDrive Web, ensuring seamless, real-time updates across devices. Important:
                                                                                                              • Writer update results in BitDefender blocking it as malware

                                                                                                                After updating Writer to latest update, Bitdefender blocked the app and writer no longer runs.
                                                                                                              • Zia Conversation Summary: Context at a glance for every customer interaction

                                                                                                                Hello everyone! Every customer conversation tells a story—but in CRM, that story is rarely in one place. A sales rep moving between multiple leads has to reopen long email threads, check call remarks, and revisit meeting notes just to remember what was
                                                                                                              • Zoho Books - New Interface keep details with PDF View

                                                                                                                Hello, The Zoho Books Interface has changed for estimates etc... One thing is causing issues though. Before the change, in PDF view you could see the detail information including custom fields entered for the estimate. Now, you have to switch between
                                                                                                              • Zoho One Unified Portal - Applications

                                                                                                                Hello, It is great to see the work on the New Unified Customer Portal. Thanks for that. The number of applications is limited though. It is now only around the Zoho Books ecosystem (Books, Expense...) and Zoho Social. = Are other applications planned
                                                                                                              • Dropdown data depends on filters in another field.

                                                                                                                In my quote form I have a lookup field called Reseller that pulls from Accounts. I would like it to pull from Accounts, but only those accounts with an account field 'Type' where that is 'Reseller'. Does anyone know a way to do this? Similarly, I'd like
                                                                                                              • Next Page