You need to sign in to do that
Don't have an account?
como_estas
apex:facet button for a new record / sobject?
Here's one that I think should be easy?
I have an <apex:pageBlock> and I am using an <apex:facet name="header"> to make my own custom stuff in the header.
I just want a button in there to create a new object. Is there an easy way to do this? Or do I seriously need to get the object prefix for this?
That would be weak.
Don't use header unless you want it only at the top. Normally apex:pageBlockButtons are used for things like apex:commandButton elements. That besides, you can return a page reference:
Replace account() with your desired object. The command button would be:
I did want it only at the top, but then when I put it in both places, I liked it better.
That said, what you said makes perfect sense. For some reason, though, the page is only refreshing and not redirecting to the page reference being returned by the method. Here's the code:
I even tried turning it into a variable and calling the setRedirect(true); method on it. Any clues?
Do you have a page override on the ContactScheduleItem__c.new button? If so, you need to add the "nooverride" parameter, thusly:
Hey I really appreciate your help. It seems that no matter what object I try here, It just opens up an edit page for the type of object on which this button is found.
The "New Attendee" button appears on a custom VF page that is an edit or a view page for a custom object OrgEvent__c
When I try to return a page reference for a standard controller edit page for any other object, it simply opens an edit page for the object i happen to have loaded in the current scope.
It must be an issue with standard controllers? Perhaps I can't create another one while there is one in scope already? Sounds stupid, but even if I try
it does the same thing. It opens an edit page for the OrgEvent__c object that i'm viewing.