You need to sign in to do that
Don't have an account?

Recreate standard 'New' button on Visualforce page
I am creating a VF page on a standard controller. I'd like to create a button on the page that opens the new Record input screen (similar to the one on any tab home page). However, I can't find the correct action syntax for my commandButton.
Is this feature actually available for VF?
Many thanks,
Guy
I think there's a much better way:
<apex:outputLink value="{!URLFOR($Action.Account.New)}">Create New Account</apex:outputLink>
All Answers
Hai
This is one way , I am not sure correct way
//page
<apex:commandButton action="{!new}" value="New"/>
// Controller
public PageReference new() {
// Give ur Object Id Instead 'a0Z', you can see this value in bottom of browser when cursor moves to your Object tab .
PageReference page = new PageReference('/a0Z/e');
page.setRedirect(true);
return page;
}
Regards
Thanga
I think there's a much better way:
<apex:outputLink value="{!URLFOR($Action.Account.New)}">Create New Account</apex:outputLink>
You should be able to invoke any of the Standard Buttons that are available with a Standard Controller using VS markup similar to this:
<apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons>
Jon, your solution works perfectly.
SCR, there is no such option for the "New" screen. (like e.g. {!New})
Is there any way to know all the actions associated with an sObject?
I ask this because the Actions are not very intuitive.
How can I say that the 'Edit All' button on the OpportunityProduct related list has the following action?
$Action.OpportunityLineitem.EditAllProduct
I would appreciate if anyone could point me to some sort of documentation for this.
Thanks
If you would like a New button instead of a URL link, you can use following markup. Replace MY_CUSTOM_OBJECT__C with name of a standard or custom object type defined in your org.
<div style='text-align:center;padding-bottom:3px;'>
<form action="{!URLFOR($Action.MY_CUSTOM_OBJECT__C.New)}" method="get" target="_parent">
<input type="hidden" name="retURL" value="{!$CurrentPage.URL}"/>
<input type="submit" value="New"/>
</form>
</div>