+ Start a Discussion

converting objects to other objects

My Organization needs multiple custom applications that will have different custom objects.  



By default Salesforce.com has the following objects, Lead, Account, Opportunity.

We are interested in creating separate applications for each one of sales teams.



Currently we have 3 sales teams…Enterprise Sales, Graduate Sales, Observation Sales.

We want to create separate applications for each sales teams, along with separate “forms” aka….objects and fields..


We would like to set up the Graduate Sales team with the following objects.


Inquires, Students, and Courses


The following are true.  Inquires are equal to leads, students are equal to accounts and courses are equal to opportunities.

The issue we are running into is, “Convert” is not a standard button on a custom Object.  We have no way to convert Inquiry data over to Students and Courses.


I know by default this solution is built into Salesforce.com.  however I do not see this feature on custom objects and I cannot view the syntax of this button  on the default Lead Object.


Is this possible to solve.  Am I able to see the syntax and overview of how this is accomplished by the convert button on the Leads object?

The short answer is that you can't leverage the convert operation generically, i.e. on custom objects.


There are a couple of ways you can go with this, however.  You could look into record types on Lead, account and opportunity and utilize the standard lead conversion routine, augmenting with your own logic as appropriate or you can model your data in separate entities (as you described below) and establish your own conversion routine in Apex, calling it from either a trigger on the Inquiry object or have a special Visualforce page accessed from a custom button on Inquiry to capture any user input required to convert.


Depending on your rules it may actually be better for you to put Inquiries and Students in the same object differed by either record types or other segmentation scheme. This would greatly simplify your conversion routine.


One additional data-model aspect to chew on is that activities in the system ("Tasks" and "Events") support two references - a "who" and a "what" and in the system only Contacts and Leads can be linked to from the "who".  If you're workflow heavily involves the standard activity objects it might sway you toward recordtypes on the standard entities depending on how you want to be able to track/report on them.


We would like to manage the user interface of the application with the tabs at the top for with different teams. 


For the Graduate Application they would see the tab labels "Inquiries, Students, Courses"

For the Enterprise Application they would see the tab labels, "Prospects, Customers, Contracts"

For the Obersation Application they would see, "Leads, Customers, Oppertunities"


The VP of Sales and COO of our company find it very important we adopt this to our sales processes. 


 From what I gather tabs can only be "Objects"


Are there examples of the code for the trigger/visual force page, that can be activated by a Button to do the conversion?




Tabs can be tied to an object or they can also just be tied to visualforce pages.  If you want separate tabs for separate records within the same object you'd need to override the detail page and list pages effectively to have the correct tab be highlighted as appropriate if you are concerned about that.


There is an example of a custom button bound to a visualforce page to create a quote from an opportunity in this article.  The same overall flow and code structure would be very similar in your solution: Page that captures user input that has a handle to the Inquiry being converted, extension class that implements the conversion logic, handles exceptions, routes the user appropriately, etc.