Here are options, examples, my comments, and my requirement for different approaches to creating Opportunities from the Standard Contact Detail Page.
I am looking for help with option 3. I need to "guarantee" that the viewed Contact is pulled through (mapped, brought over, carried over) to the Opportunity as an OpportunityContactRole. Options 1 and 2 do not guarantee it.
Option 1 (i considered this, but it will not solve my question)
- From the Standard Contact Detail Page the Standard Opportunity Related List's standard "New" button does not pull contact information to the resulting opportunity therefore is not a good solution.
Option 2 (i considered this, but it will not solve my question)
- There's a great article about this option. From the Standard Contact Detail Page a custom "New" Opportunity URL Button placed in the Opportunity Related List or placed on the standard Contact Detail Page could pull contact information to the resulting opportunity (via URL params) but it is not guaranteed because the user can always change (hack) the URL parameters in their browser to omit the "conid" parameter therefore solutions like this (though helpful to some people) are not ideal if you want to guarantee that contact attribution happens on the resulting opportunity
- Another challenge with this approach is when you have custom Read Only fields on Contact that you want mapped (brought over) to the resulting Contact. In such scenario passing the values via URL parameters is not possible because the datafields in this scenario are read only in field-level security (FLS). This is the requirement I have so I need to explore option3 below.
Option 3 (How would you further design this option 3 to solve the question and to meet the requirements below?)
To guarantee that Opportunities created from Contact Page have the Contact as an OpportunityContactRole, maybe we create a visualforce button on the standard contact detail page that calls server-side apex.
- I assume this approach is capable of preventing the user from omitting the OpportunityContactRole. How might we do this?
- Perhaps the button could call apex that inserts the opportunity & OpportunityContactRole but the example found here gives the user no edit screen prior to inserting the record which is bad user-experience.
- I require a button labeled "Create New Opportunity" to be placed on the Standard Contact Detail Page. When clicked, the button must redirect the user to a page where they can edit new opportunity information. I want them to have a cancel and save button. If they click cancel they should be redirected back to the Contact record. If they click save then I want the opportunity & OpportunityContactRole to be inserted. Assuming that the solution involves visualforce, I dont want to have to maintain the visualforce page later in time so I want its form fields to dynamically generate based on whatever fields are required on Opportunity.