+ Start a Discussion
KasriftKasrift 

Custom VF page from custom button

Hello,

I've created a custom VF page which looks exactly how I want it in the preview, however I am not quite sure how to implement it the way that I would like.  The VF is a custom page that looks like the Case record creation page with a dynamic field component.  Everything looks fine on the VF page, but I was curious what the requirements are for creating a custom button that can be used as a list button.

The issue I'm having is that the button I want to create is on Cases.  I want to have the button show on the list view of Cases on the Opportunity detail page (Cases has a lookup field to Opportunities & there is no master/detail or parent relationship).  Using a standard controller for Cases, I can't get a record to be created properly and end up with the error "ID value ..... is not value for the Case standard controller".  I understand that I am using the Standard controller for Cases on the Opportunity page layout, but I'm not sure what I need to adjust to make this button work properly.  Any help would be appreciated.

-Stephen
Sonam_SFDCSonam_SFDC
Hi,

When you create a custom button on the detail page - it will throw this erro if you are calling a standard controller of any other object as you are facing right now.

Instead, what you can do is create a controller extension in which you can create records for any object you wish - read more in detail:https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yWMIAY

KasriftKasrift
Thank you Sonam,

I figured that I would have to write either a custom controller or extension, but was just looking to see if there was something that I was missing. Just to clarify, I am trying to make a List Button on Cases under App Setup>Cases>Buttons, Links and Actions.  I am using this button on the Opportunity Detail page that has a related list view of Cases on the Opportunity.  For the Custom VF, I am using the standardController="Case", since I am trying to create a dynamic Case creation page that has sections that show dynamically based on picklist values from one field.

My extention that I need to create needs to get/set & list Opportunities, correct?  I apologize if this is a basic question, still learning coding and I haven't ran into a need to create an extension class yet, only custom controllers. 

-Stephen