Automatically name your Deals during lead conversion
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 best practice is to have a standard naming convention for deals that enables easy management. That said, doing this manually during every lead conversion is not only time-consuming, but is also error-prone. The Function I’m sharing this week helps automate this process.
Each of us follow different naming conventions for deals that help quick recall and management. The code I’m sharing uses your Account name and the related Product name. This helps you easily relate the Account and the Product associated with the Deal. This might sound simple enough, but like they say, God is in the details :) Most often, the smallest details make the biggest impact.
- Create a custom field under the name "Product Name" field in the Leads and Deals module before the lead conversion.
- Whenever you click 'Convert' in the Lead record, you can see a "Lead Conversion Mapping" option in the right pane.
- Map the "Product Name" custom field in the Leads module to the one in the Deals module.
Getting started with the function:
- Go to Setup > Developer Space > Functions > + Create New Function.
- Select Automation as Function type and click Next.
- Provide a name for the function. Add a description(optional).
- Copy the code given below.
- Click Edit Arguments.
- Enter the name as dealId and select the type as Int.
- Enter the name as acctname and select the type as String.
- Enter the name as productname and select the type as String.
- Click Save&Execute Script.
- Click Save.
mp=map(); mp.put("Deal_Name",acctname +" - " + productname); update = zoho.crm.update("Deals", input.dealId.toLong(), mp); info mp; info update;
Adding to the 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" in the "When do you want to execute this rule?".
- Select "Create".
- Select the Condition as "All Deals".
- Select the checkbox "Repeat this workflow whenever a record is edited." and Click Next.
- Choose "Function" from Instant Actions.
- Select the option "Function" (Created by users from your organization).
- Select the required function and click Configure.
- Click Save and Associate.
- Save the workflow.
- The above code works only for API V2.0 and not the previous version.
Found this useful? Try it out and let us know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful!