Someone in your organization may have accidentally added vendors as accounts, or you imported contacts and later found that some of their related accounts were actually vendors. You can manage this by categorizing accounts by type, such as customers and vendors. However, it gets more complicated when setting up the Zoho Books integration, as you need to designate an account as a vendor to receive bills. All of these situations underscore the necessity of being able to convert an account into a vendor.
Although this feature is not readily available in your CRM, our low-code tools enable you to create a custom function that can automatically convert an account into a vendor. This function can then be connected to a custom button in the accounts module, making conversion possible at the click of a button. Continue reading to learn more.
Permissions and availability
- Users with the Modules Customization permission can create custom buttons.
- Users with the Manage Extensibility permission can write custom functions.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Create and link the button with the custom function, as detailed in the "Create a button" section below. Learn more
- Test the function in a sandbox before deploying it in your production environment. Learn more
Create a button
Follow the steps below to create a custom button in the Accounts module that converts the account into a vendor record when clicked.
- Navigate to Setup > Customization > Modules and Fields > Accounts > Buttons > Create New Button.
- Provide a name for the button. For example: "Convert as Vendor".
Add a description (optional). - Choose the layouts where you want the button to be placed.
- Specify the button's placement as In Record and its position on the page as Details.
- Select the action to be performed as Writing Function.
- Provide a name and display name for the function, then click Create.
- On the Deluge script editor, do the following:
- Copy and paste the code provided below.
- Click Edit Arguments.
- Enter the name as accId, select the value as Accounts - Account Id, and then click Save.
- Save the function.
- Select the profiles who can view this custom button.
- Click Save.
The code
acctDetails = zoho.crm.getRecordById("Accounts",accId);
mp = Map();
mp.put("Vendor_Name",ifnull(acctDetails.get("Account_Name"),""));
mp.put("Description",ifnull(acctDetails.get("Description"),""));
mp.put("Street",ifnull(acctDetails.get("Billing_Street"),""));
mp.put("City",ifnull(acctDetails.get("Billing_City"),""));
mp.put("State",ifnull(acctDetails.get("Billing_State"),""));
mp.put("Country",ifnull(acctDetails.get("Billing_Country"),""));
mp.put("Zip_Code",ifnull(acctDetails.get("Shipping_Code"),""));
mp.put("Phone",ifnull(acctDetails.get("Phone"),""));
mp.put("Website",ifnull(acctDetails.get("Website"),""));
mp.put("Currency",ifnull(acctDetails.get("Currency"),""));
mp.put("Exchange_Rate",ifnull(acctDetails.get("Exchange_Rate"),""));
mp.put("Owner",ifnull(acctDetails.get("Owner"),"").get("id"));
info mp;
create = zoho.crm.createRecord("Vendors",mp);
info create;
//Delete the account record
deleteResp = zoho.crm.invokeConnector("crm.delete",{"module":"Accounts","id":accId});
info deleteResp;
return "Vendor created successfully";
Notes
- Make sure to use the accurate API names for their corresponding fields in the code snippet. Learn more
- You can include additional fields in the code snippet to transfer their information from accounts to vendors.
- Converting an account record into a vendor will result in the deletion of the account record and potential data loss. It will move all related records, such as activities, contacts, deals, quotes, sales orders, invoices, and cases, to the Recycle Bin along with the account.
- Remove the last four lines in the code snippet above to avoid deleting the account record.
Tip
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- In the Accounts module, click on a particular account you want to convert into a vendor.
- Click the custom button you've created in the steps above.
- Check whether a new vendor record has been created with the account details and whether the current account record has been deleted and moved to the recycle bin.
- Make sure that all account information is accessible in the vendor record.
Did you find this useful? Try it out and let us know how it works. Share this with your team if they'd benefit from it! If you have questions, please don't hesitate to contact us.
More info
- ModuleAccounts
- Trigger PointCustom Button
- EditionEnterprise and above
- ComplexityMedium
- Implementation Time30 minutes

Looking for a custom solution?
Contact us, we will help enhance your productivity at lightning speed.
SUBMIT REQUEST