Pages

Sunday, January 26, 2014

Salesforce: Default Lead Conversion

In previous blog, we discuss about validation rule when user convert lead. Now, we have new requirement, can we set default values when user click Convert button in Lead?

By default there is no function  from Salesforce to set the default value, but there is a workaround for this, which is adding parameters to the URL. Here we go:

1. Create custom Convert button
Use this button instead of standard Convert button.
  • Go to Setup - Customize - LeadsButtons, Links, and Actions
  • Click New Button or Link
  • You can select Content Source = OnClick JavaScript

  • or Content Source = URL

  • Example: if you want default "Do not create a new opportunity upon conversion" is checked, add this formula in the formula field:
    • JavaScript: window.location.href="/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&nooppti=1"
    • URL: /lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}&nooppti=1

2. Edit Lead Page Layout
Remove standard Convert button and add new custom button created in Lead page layout, you can the button name  different.
  • Go to Setup - Customize - Leads - Page Layouts
  • Click Edit link for page layouts
  • Select Buttons in the layout
  • Drag and drop the button to add and remove 


Here list of parameters you can use in the custom button:
Convert Lead
  • "Do not create a new opportunity upon conversion" checked -- nooppti=1
  • "Send Email to Owner" checked -- sem=1
  • "Opportunity Name" -- noopptt={!Lead.Name} - opty
  • "Converted Status" -- cstatus=New Status
Task Information
  • "Subject" -- tsk5_fu=Mission Critical Task
  • "Status" -- tsk12_fu=Deferred
  • "Priority" -- tsk13_fu=High
Description Information
  • "Send Notification Email" -- email_followup=0
  • "Comments" -- tsk6_fu=No Comment
Reminder 
  • "Reminder" -- IsReminderSet_fu=0

You can check more fields you can pre-populate by default or if you have custom Task field to add, go to View Source by right click the page and look for name related to the field, example: <input  id="00N50000002DnFJ_fu" maxlength="200" name="00N50000002DnFJ_fu" size="20" type="text" /> For this example, the parameter would be 00N50000002DnFJ_fu=abc

Hope this help Salesforce admin.


No comments:

Post a Comment

Page-level ad