Thursday, January 26, 2012

Visualforce Custom button

As Salesforce has deprecated the sControl and hence there is more need to build the custom button using visualforce. We will go through to designing of custom button using Visualforce and apex code.

Here I have given simple example

Step - 1 : Create Apex class with logic which needs to execute on click on custom button.

public with sharing class CustomButtonExample {
    private final ApexPages.StandardController theController;

    public CustomButtonExample (ApexPages.StandardController controller) {
        theController = controller;
    }

    public PageReference doCheckLogic() {
     String theId = ApexPages.currentPage().getParameters().get('id');
        try{
            // do something
        }
        catch(Exception e){
        }
       return theController.view().setRedirect(true);
    }
}

Step - 2 : Create Visualforce
   
   <apex:page action="{!doCheckLogic}" extensions="CustomButtonExample" 
            standardcontroller="Opportunity"> </apex:page>

Remember that the custom controller you build must be extensions 
in Visualforce page.

Step - 3 : Create Custom Button
Go to setup->App Setup-> Customize -> Custom Object -> Buttons and Links provide the parameters and select the Visualforce create from the list.

Step - 4 : Put Custom button on page layout.

You are done !!

Wednesday, December 15, 2010

Salesforce Interview Questions

1) How do you hide Header and Sidebar on Visualforce page?
2) What is difference between standard and custom controller?
3) What is Controller extension?
4) How do you read parameter in Visualforce page?
5) How many dependent drop down can be put on one Visualforce page?
6) What is the maximum size of the PDF generated on Visualforce attribute renderAs?
7) How to use actionPoller tag?
8) What is difference between actionFunction and actionSupport Tag ?
9) How can we check the object accessibility on visualforce page?
-{!$ObjectType.MyCustomObject__c.accessible}
10) How many rows return by list controller?
-10000
11) What is custom component?
12) What is assignTo attribute and what is its use?


Welcome to Salesforce Development Blog

Welcome to Salesforce Development. We will discuss various aspect of the Salesforce. Problem and solution of the Salesforce and some development tips for the Developer.

Visualforce Custom button

As Salesforce has deprecated the sControl and hence there is more need to build the custom button using visualforce. We will go through to ...