Wednesday, January 6, 2021

Remove hyphen automatically from Opportunity name on Lead conversion

Hi Trailblazers


I had a client who was not happy with the hyphen (-) which Salesforce automatically appends to an opportunity during lead conversion.

Something small but it could prove to be useful on your many trails.

Follow the steps to remove the hyphen (-) automatically from the Opportunities Name upon Lead conversion.


Example: LEAD NAME (THE COMPANY INC) CONVERTED TO OPPORTUNITY (THE COMPANY INC- )

This is standard Salesforce functionality. By default, Salesforce allows Users to add the name which starts with Account Name -. So they can edit that name and use some other name. Generally, people use Account Name-Opportunity Name.


This can be accomplished by using a workflow rule, with field updates based on a formula that checks for hyphen:

 

Create a workflow rule to remove hyphens from the Opportunity Name when an Opportunity is created:

 

  1. Classic: Go to Setup | Workflow Rules | Click New Rule or  Lightning Experience: Gear Icon | Search for Workflow Rules | Click New Rule
  2. Select the Object as Opportunity
  3. Enter Rule Name
  4. Choose to evaluate the rule when a record is: created
  5. Then select the Rule Criteria as: formula evaluates to true

Use Rule: 

IF 

CONTAINS(Name,'-'),true,false 

 

  1. Click Save and Next
  2. Add Workflow Action to update New Field
  3. On the Field Update Edit page, enter a Name for the field update, and select Opportunity Name as the Field to Update.
  4. Specify New Field Value as below: 

SUBSTITUTE( Name , '-', '') 

 

  1. Activate the workflow rule. 

May the Force be with you!


Generate reports from Opportunities using a Visualforce Page in Salesforce

  Step 1: Create a Visualforce Page Go to the Setup menu in Salesforce. Search for "Visualforce Pages" in the Quick Find box and c...