function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
b-liub-liu 

How to find StandardController Methods

Looking to recreate the buttons on the page layouts to my custom Visual Force page. How do you find the Methods in the objects standard controllers?

NzgonNzgon

See here:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_std.htm

 

Command buttons and links that are associated with save, quicksave, edit, or delete actions in a standard controller are only rendered if the user has the appropriate permissions. Likewise, if no particular record is associated with a page, command buttons and links associated with the edit anddelete actions are not rendered.

Using Standard Controller Actions

Action methods perform logic or navigation when a page event occurs, such as when a user clicks a button, or hovers over an area of the page. Action methods can be called from page markup by using {! } notation in the action parameter of one of the following tags:

The following table describes the action methods that are supported by all standard controllers. You can associate these actions with any Visualforce component that includes an action attribute.

Action Description
saveInserts a new record or updates an existing record if it is currently in context. After this operation is finished, the save action returns the user to the original page (if known), or navigates the user to the detail page for the saved record.
quicksaveInserts a new record or updates an existing record if it is currently in context. Unlike the save action, this page does not redirect the user to another page.
editNavigates the user to the edit page for the record that is currently in context. After this operation is finished, the edit action returns the user to the page where the user originally invoked the action.
deleteDeletes the record that is currently in content. After this operation is finished, the delete action either refreshes the page or sends the user to tab for the associated object.
cancelAborts an edit operation. After this operation is finished, the cancel action returns the user to the page where the user originally invoked the edit.
listReturns a PageReference object of the standard list page, based on the most recently used list filter for that object. For example, if the standard controller is contact, and the last filtered list that the user viewed is New Last Week, the contacts created in the last week are displayed.
For example, the following page allows you to update an account. When you click Save, the save action is triggered on the standard controller, and the account is updated.
<apex:page standardController="Account"> 
  <apex:form>
    <apex:pageBlock title="My Content" mode="edit">
      <apex:pageBlockButtons>
        <apex:commandButton action="{!save}" value="Save"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection title="My Content Section" columns="2">
        <apex:inputField value="{!account.name}"/>
        <apex:inputField value="{!account.site}"/>
        <apex:inputField value="{!account.type}"/>
        <apex:inputField value="{!account.accountNumber}"/>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>
Note
Remember, for this page to display account data, the ID of a valid account record must be specified as a query parameter in the URL for the page. For example:
https://Salesforce_instance/apex/myPage?id=001x000xxx3Jsxb
Displaying Field Values with Visualforce has more information about retrieving the ID of a record.
Note
b-liub-liu

Those are the standard methods yes and I've already seen that documentation, but I'm looking for where can find the methods of objects where in a page layout the standard and custom buttons work. I'm trying to replicate those buttons on a visualforce page

 

NzgonNzgon

You need to define custom method using standard controller extension and define your logic there.

In visual force page use <apex:commandButton/> and call your method.


Nash

 

b-liub-liu

Is there not another way? I mean if the standard page layout already have the buttons made and working, isn't there a way to just refer to them?

NzgonNzgon

See this:



 

Adding Custom List Buttons using Standard List Controllers

In addition to overriding standard buttons and links, you can also create custom list buttons that link to pages that use a standard list controller. These list buttons can be used on a list page, search results, and any related list for the object and allow you to take actions on a group of selected records. To indicate the set of records that have been selected, use the {!selected} expression.

For example, to add a custom button to a related list for opportunities that allows you to edit and save the opportunity stage and close date on selected records:
  1. Create the following Apex class:
    public class tenPageSizeExt {
    
        public tenPageSizeExt(ApexPages.StandardSetController controller) {
            controller.setPageSize(10);
        }
    }
  2. Create the following page and call it oppEditStageAndCloseDate:
    <apex:page standardController="Opportunity" recordSetVar="opportunities" tabStyle="Opportunity" extensions="tenPageSizeExt"> 
        <apex:form >
            <apex:pageBlock  title="Edit Stage and Close Date" mode="edit">
                <apex:pageMessages />
                <apex:pageBlockButtons location="top">
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>
                </apex:pageBlockButtons>
                <apex:pageBlockTable value="{!selected}" var="opp">
                    <apex:column value="{!opp.name}"/>
                    <apex:column headerValue="Stage">
                        <apex:inputField value="{!opp.stageName}"/>
                    </apex:column>
                    <apex:column headerValue="Close Date">
                        <apex:inputField value="{!opp.closeDate}"/>
                    </apex:column>
                </apex:pageBlockTable>      
            </apex:pageBlock>
        </apex:form>
        </apex:page>
  3. Make the page available to all users.

 

NzgonNzgon

For just use standard metods put this on your VF page:

 



 

<apex:pageBlockButtons location="top">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/> 
</apex:pageBlockButtons>
b-liub-liu

Those are the basic ones that come with any standard controllers. I'm looking for the way to get other buttons for an object. The info you are giving me has already been found online easily but finding the specific way to get the other buttons like "sharing" or "include offline" for the "account"