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
amorganamorgan 

Populate Contact in Opportunity when New Opportunity button is pressed under Contact

I have a lookup field in my opportunity that I want populated when I create a new opportunity under a contact. When I press the button "New Opportunity", under my opportunity related list while looking at a contact, it takes me to the new opportunity page. Then I notice that there is a &conid=0038000000X2jvq in the URL which is the correct contact that I want. But, how do I get that contact in my custom lookup field?
amorganamorgan
I created a VisualforcePage using the standard controller and built an extension that would set the field in the opportunity with the page parameter then overrode the opportunity NEW button. Now the problem is that I can't use page layouts anymore. It seems that I have to build the whole edit screen of the opportunity page layout. Which means no more page layout assignments or page layout editor. All I want is something like but in edit mode. If I could only add my extension class to the standard opportunity edit page then I would have what I want. I don't want to get stuck re-drafting the whole page, and putting in rules for profiles, etc. It opens a whole can of worms. Any better alternatives?