How to add Visualforce page to page layout in Salesforce

Source: Internet
Author: User

In Salesforce, we can add our custom Visualforce Page to the layout corresponding to object. At this point, Visualforce page and asp.net mvc partial view have the same beauty.

So how do you complete the process? See the following procedure:

1): In the Custom Visualforce page to add the following label

"Standardcontroller flag This page can be added to which object corresponds to the layout"

"Extensions specifies the corresponding background class file"

<apex:page standardcontroller= "Account" extensions= "Creditlimitcontroller" >

2): Process the background of the class file, to complete the specific logic we need

"Apexpages.standardcontroller corresponds to the Standardcontroller specified in page"

"(account) Controller.getrecord () Gets the object of the current operation, which is pointed to the account, which essentially gets the ID of the object, and for other more detailed information, you need to query by ID."

public class Creditlimitcontroller {
    //added A instance varaible for the standard controller
    private APEXPAGES.S Tandardcontroller controller {get; set;}
    The actual account is
    private account A;
        
    Public Creditlimitcontroller (Apexpages.standardcontroller Controller) {
     
        //initialize Stanrdard
        This.controller = controller;
        THIS.A = (account) Controller.getrecord ();
            
        System.debug ('---------002Account Id  ' + this.a.id);
    }

3: The previous 2 steps have already prepared the custom Visualforce page, and then we go to the page layout for account, as shown in the following figure

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.