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?

  • Do you by chance have a namespace prefix? You need to include that in teh standard controller assignment if you have one. – Chris Duncombe Oct 16 '13 at 13:26
  • No. No there is not a namespace prefix. – Robert Harper Oct 16 '13 at 13:29
  • is it a syntax error should look like this, standardcontroller="APIName__c" – TimChadwick Oct 16 '13 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. – Robert Harper Oct 16 '13 at 14:11
  • You can try changing your custom object in Eclipse <actionOverrides> <actionName>new</actionName> <content>pagename</content> <type>Visualforce</type> </actionOverrides> – TimChadwick Oct 16 '13 at 14:20
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.

| improve this answer | |
  • Since I'm an administrator in my org, I doubt that is the problem. – Robert Harper Oct 16 '13 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. – Robert Harper Oct 16 '13 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 – Chris Duncombe Oct 16 '13 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. – Robert Harper Oct 16 '13 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 '13 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">
| improve this answer | |
  • 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 – Brian Ford Apr 29 '14 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.