Turn a Contact into a Vendor
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.
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 function
- Go to Setup > Customization > Modules > Deals > Links and Buttons > + New Button.
- Provide a name for the button. For example: "Create Quote from deal". Add a description(optional).
- Select the placement of the button as View Page.
- Select the action to be performed as "Writing Function".
- Copy the code given below.
- Click "Edit Arguments".
- Enter the name as "contactId" and select the value as "Contact Id".
- Click Save & Execute Script.
- Save the changes.
- Select the profiles who can view this button.
- Click Save.
This example code is for creating a record in Vendors module from Contacts module.
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";
- The code is zoho.crm._getRecordById for Version 1.0 of.
- This 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!