6

I'm attempting to override the New button for a custom object. I have the attribute standardController= set to the API name of the custom object. When I edit the behavior of the new button for the object, I do not see my VisualForce page in the drop down to select.

What could be wrong?

9
  • Do you by chance have a namespace prefix? You need to include that in teh standard controller assignment if you have one. Oct 16, 2013 at 13:26
  • No. No there is not a namespace prefix. Oct 16, 2013 at 13:29
  • is it a syntax error should look like this, standardcontroller="APIName__c" Oct 16, 2013 at 13:57
  • There are no syntax errors. The page runs fine if I go to that URL. FWIW, the custom object name is Interface_Client__c. I have standardController="Interface_Client__c" inside the <apex:page> tag. The problem is that I don't see the VisualForce page listed to override the New button with. Oct 16, 2013 at 14:11
  • You can try changing your custom object in Eclipse <actionOverrides> <actionName>new</actionName> <content>pagename</content> <type>Visualforce</type> </actionOverrides> Oct 16, 2013 at 14:20

3 Answers 3

1

You need to make sure the page tag is set up correctly, something like this:

<Apex:page standardcontroller="MyCustomObject__c" >

You also need to make sure that the page is visible to the user, in the security section of the page, and that the user has create permission on the custom object.

5
  • Since I'm an administrator in my org, I doubt that is the problem. Oct 16, 2013 at 14:41
  • Our guess is that it has more to do with the recordSetVar attribute set in the apex:page tag. If I remove it, I get an error about not being able to cast one object to another type. Oct 16, 2013 at 14:46
  • 1
    IF you think that might have something to do with it, you should add the code to the question so we can have all the information Oct 16, 2013 at 14:49
  • The recrodSetVar was the problem. I removed that and for some reason had to mess with the controller but the net effect of what I changes did nothing. Oct 16, 2013 at 18:52
  • I am not clear why you would have a recordsetvar on your new button. The recordsetvar is for iterating over a list of existing records of a certain object type. Can you describe in more detail why you are overriding the New button and what you hope your VF page will do. Post your code for the page as well.
    – JimRae
    Oct 16, 2013 at 21:18
1

I had the same problem and page 119 of the Visualforce Developer's Guide helped me out. You need to make sure the recordSetVar and tabstyle are included in your opening apex:page tag

<apex:page docType="html-5.0" showHeader="false" standardStylesheets="false" standardController="Competition__c" recordSetVar="competitions" tabStyle="Competition__c">
1
  • update: recordSetVar needs to be used for standard list controllers not standard controllers. This is the case for related lists, list pages and mass action pages
    – user3970
    Apr 29, 2014 at 22:37
0

I had an issue very similar to this.

I was trying to override the Add button on the Product Object.

I was using a StandardSetController, when I could use a StandardController for the functionality I was trying to achieve.

Once I switched to using the StandardController, the VisualForce Page I was working on popped up in the Add button edit menu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .