function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Convert Button Help

In, I have created a new tab and custom object called Prospects which will include a list of potential customers that are not yet classed as opportunities (missing a few key requirements) however I want to be able to convert my new custom object (prospects) into an opportunity when those previous requirements have been met. 


This is how my boss wants it.


I want to have a convert button on the Prospect records. So that when our sales team are satisfied that those requirements have been met they can then convert the information that is captured all ready within the prospect custom object into an opportunity.


So any advice on how I create this Convert button would be much appreciated?



Thank you!


The obvious question is: Why aren't you just using Leads which seem to be what your boss wants?   But I digress... assuming you really do what what you've outlined you merely need to write a Visual Force page that does nothing but calls an action on a custom controller that you write and then redirect to the resulting page.  This is a one line VF page.

Then, in your controller which would be an extension to the standard Prospect__c controller, you build a new Opportunity object from the data you need from the Prospect object, save it, and then return a pageReference which would navigate your users to the new Opportunity Object.


You create a Convert button on the Prospect object that points to the VF page.


Just typing off the top of my head:


VF page:


<apex:page standardController="Prospect__c" extensions="MyProspectControllerExtension" action="{!doCreateOpportunity}" />





public with sharing class Controller_Create_Opportunity_1_Click {
public ApexPages.StandardController CONTROL;
private Id launchId;
public Opportunity newOpp {get; set;}
public Controller_Create_Opportunity_1_Click (ApexPages.StandardController stdController) {
this.CONTROL = stdController;
launchId = this.CONTROL.getId();
newOpp = new Opportunity();


public with sharing class CMyProspectControllerExtension {

  public ApexPages.StandardController CONTROL;

public MyProspectControllerExtension(ApexPages.StandardController stdController) {

      this.CONTROL = stdController;


public pageReference doCreateOpportunity() {

      newOpp = new Opportunity();

     Prospect__c prospect = [select Id, Name, Field1, Field2, Field3, etc from Prospect__c where id = :CONTROL.getId()];

     // add your field mappings here

     newOpp.Name = prospect.Name;

     newOpp.Field1 = prospect.Field1;

     // etc.

     insert newOpp;

     pageReference p = new pageReference('/' +;


     return p;




Best, Steve.


Hey Steve,


Thanks for the response. Sorry, but could you please break it down? we only have Professional Edition at the moment and I am new to salesforce.


We are not using leads because these "prospects" are potential accounts not contacts - so extremely similar to an opportunity but are not specifically classed as one yet, if you get what I mean haha. However we link the specific lead(s) to the prospect custom object within the layout.








Ah.. in the Professional version, without VisualForce and Apex, I'm not sure exactly how you would do this.



A Lead can be converted into an Account, Contact and Opportunity.  I might suggest you look into it again as the concept of a "potential account" is almost exactly the same as an "unqualified lead".    But, I'll stop beating that horse.  :-)



If these are Prospective *Accounts*, then another question is why you're converting them into Opportunities?   You might instead create two Account Record Types.  One called a "Prospective Account" and the other the standard "Account".  Having two record types means you can have two page layout, one for each record type.  Then, when you want to "convert" one to the other, you can merely change the Record Type in the Edit page.    If you then want to create an Opportunity from an Account, you can create a Button to do that without coding VF/Apex.


Best, Steve.


Ahh awesome thank you,


I think the alternative layout suggestion is a goodie, however a quick question on that. Will both of those layouts apppear on the report? as well as be able to tell that they are different in the report?


With Professional edition, you also don't have multiple page layouts or record types. 


Why not just have a button on the Prospect record that takes information from that page, then creates a new Account. Then from the account, click the standard New Opportunity button.


The button from the Prospect record would look something like this:


/001/e?acc2=Prospect Name

&acc10=Prospect Phone



If you're ultimately just looking to link an Opportunity to the prospect record, why not just put a lookup field on the Opportunity to the Prospect and click a button from the Prospect to link an Opportunity to it. 


If you don't use the standard lead convert process, you're not going to be creating a Contact/Account/Opportunity in one click unless you use APEX and Visualforce (which is not an option for Pro Ed). 


Hope this helps.


My bad... he's right.   -Steve