Date picker in Visualforce page

Sample Code1:

Visualforce page:

<apex:page docType="html-5.0" controller="Sample">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockSection>
            <apex:pageBlockSectionItem>
                Date: <apex:input type="date" value="{!dat}"/>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

Apex Controller:

public class Sample {
    public Date dat {get;set;}
    public Sample() {

    }
}

Output:



Sample Code2:

Visualforce page:

<apex:page controller="datePicker" id="mypage">
    <apex:form>   
       
Date: <apex:inputText value="{!datename}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);" />   
    </apex:form>
</apex:page>


Apex Controller:

public class DatePicker
{
    public String datename {get; set;}
}


Output:



Cheers!!!

Sample date picker

Sample Code:

<html>

<head>

<script language="JavaScript">

function show_calendar(str_target, str_datetime) {
    var arr_months = ["January", "February", "March", "April", "May", "June",
        "July", "August", "September", "October", "November", "December"];
    var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
    var n_weekstart = 1; // day week starts from (normally 0 or 1)

    var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt(str_datetime));
    var dt_prev_month = new Date(dt_datetime);
    dt_prev_month.setMonth(dt_datetime.getMonth()-1);
    var dt_next_month = new Date(dt_datetime);
    dt_next_month.setMonth(dt_datetime.getMonth()+1);
    var dt_firstday = new Date(dt_datetime);
    dt_firstday.setDate(1);
    dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
    var dt_lastday = new Date(dt_next_month);
    dt_lastday.setDate(0);
   
    // html generation (feel free to tune it for your particular application)
    // print calendar header
    var str_buffer = new String (
        "<html>\n"+
        "<head>\n"+
        "    <title>Calendar</title>\n"+
        "</head>\n"+
        "<body bgcolor=\"White\">\n"+
        "<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
        "<tr><td bgcolor=\"#4682B4\">\n"+
        "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
        "<tr>\n    <td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar('"+
        str_target+"', '"+ dt2dtstr(dt_prev_month)+"'+document.cal.time.value);\">"+
        "<img src=\"prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
        " alt=\"previous month\"></a></td>\n"+
        "    <td bgcolor=\"#4682B4\" colspan=\"5\">"+
        "<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"
        +arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+
        "    <td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
        +str_target+"', '"+dt2dtstr(dt_next_month)+"'+document.cal.time.value);\">"+
        "<img src=\"next.gif\" width=\"16\" height=\"16\" border=\"0\""+
        " alt=\"next month\"></a></td>\n</tr>\n"
    );

    var dt_current_day = new Date(dt_firstday);
    // print weekdays titles
    str_buffer += "<tr>\n";
    for (var n=0; n<7; n++)
        str_buffer += "    <td bgcolor=\"#87CEFA\">"+
        "<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+
        week_days[(n_weekstart+n)%7]+"</font></td>\n";
    // print calendar table
    str_buffer += "</tr>\n";
    while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
        dt_current_day.getMonth() == dt_firstday.getMonth()) {
        // print row heder
        str_buffer += "<tr>\n";
        for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
                if (dt_current_day.getDate() == dt_datetime.getDate() &&
                    dt_current_day.getMonth() == dt_datetime.getMonth())
                    // print current date
                    str_buffer += "    <td bgcolor=\"#FFB6C1\" align=\"right\">";
                else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
                    // weekend days
                    str_buffer += "    <td bgcolor=\"#DBEAF5\" align=\"right\">";
                else
                    // print working days of current month
                    str_buffer += "    <td bgcolor=\"white\" align=\"right\">";

                if (dt_current_day.getMonth() == dt_datetime.getMonth())
                    // print days of current month
                    str_buffer += "<a href=\"javascript:window.opener."+str_target+
                    ".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
                    "<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
                else
                    // print days of other months
                    str_buffer += "<a href=\"javascript:window.opener."+str_target+
                    ".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
                    "<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
                str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
                dt_current_day.setDate(dt_current_day.getDate()+1);
        }
        // print row footer
        str_buffer += "</tr>\n";
    }
    // print calendar footer
    str_buffer +=
        "<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
        "<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
        "Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
        "\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" +
        "</table>\n" +
        "</tr>\n</td>\n</table>\n" +
        "</body>\n" +
        "</html>\n";

    var vWinCal = window.open("", "Calendar",
        "width=200,height=250,status=no,resizable=yes,top=200,left=200");
    vWinCal.opener = self;
    var calc_doc = vWinCal.document;
    calc_doc.write (str_buffer);
    calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
    var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
    if (!re_date.exec(str_datetime))
        return alert("Invalid Datetime format: "+ str_datetime);
    return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}
function dt2dtstr (dt_datetime) {
    return (new String (
            dt_datetime.getDate()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
    return (new String (
            dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}

</script>

</head>

<body>

<form name="tstest">

Date:&nbsp;&nbsp;&nbsp;
<input type="Text" name="timestamp" value="">
    <a href="javascript:show_calendar('document.tstest.timestamp', document.tstest.timestamp.value);">
        <img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp">
    </a>

</form>

</body>

</html>


Download the below images:




Output:

Multiple Approvers in Approval process in Salesforce

If you specify multiple approvers in the Automatically assign to approver(s) option, choose one of the following:
1. Approve or reject based on the first response

The first response to the approval request determines whether the record is approved or rejected.
2. Require unanimous approval from all selected approvers

The record is only approved if all of the approvers approve the request. The approval request is rejected if any of the approvers reject the request.
Cheers!!!

Upserting data using Apex Data Loader

Loads data from a data source into Salesforce, where existing records with a matching custom external ID field are updated; records without matches are inserted as new records.

If you are performing an upsert:

  1. Your CSV file must contain a column of ID values for matching against existing records. The column may be either an external ID (a custom field with the “External ID” attribute), or Id (the Salesforce record ID). From the drop-down list, select which field to use for matching. If the object has no external ID fields, Id is automatically used. For more information on external IDs, see “Custom Field Attributes” in the online help. Click Next to continue.
  2. If your file includes the external IDs of an object that has a relationship to your chosen object, enable that external ID for record matching by selecting its name from the drop-down list. If you make no selection here, you can use the related object's Id field for matching by mapping it in the next step. Click Next to continue.
Cheers!!!

Difference between Export and Export All

Export :  It is used to export the Salesforce Data(excluding recycle bin's data) into your local  system.

Export All :  It is used to export the Salesforce Data(including recycle bin's data) into your local system.

Cheers!!!

Salesforce.com Releases per year

Salesforce.com Releases per year are as follows
    1)  Spring (February to May)

    2)  Summer(June to September)

    3)  Winter(October to January)
      The exact dates of the releases are published a month or so in advance.

      https://trust.salesforce.com is the best place to find out the exact date for a particular release.

      Cheers!!!

      Welcome message and update notification trigger in Salesforce

      Sample Code:

      trigger memberInviteNotify on Member__c (after insert,after update)
      {
          for(Member__c member:trigger.New)
          {
              String[] toAddresses = new String[] {member.E_Mail_Id__c};
              String messageBody;
              Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
              mail.setToAddresses(toAddresses);
             
              //Email invitation
              if(trigger.isInsert)
              {
                  mail.setSubject('Welcome to Sweet 16 Siebel Batch');
                  messageBody = '<html><body>Hi ' + member.Name + ',<br>Welcome to Sweet 16.<br><br><b>Regards,</b><br>Magulan D</body></html>';
                  mail.setHtmlBody(messageBody);  
              }
             
              //Email notification
              if(trigger.isUpdate)
              {
                  mail.setSubject('Updates in your details');
                  messageBody = '<html><body>Hi ' + member.Name + ',<br>Changes have been made to your details. <br><br>Contact administrator if you are not responisble.</body></html>';
                  mail.setHtmlBody(messageBody);
              }
              Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
          }
      }

      Executing Trigger based on field value in Salesforce

      Sample Trigger:

       trigger test on Member__c (after insert)
      {
          List<Case> cases = new List<Case>();

          for(Member__c mem:Trigger.new)
          {
              if(
      mem.Comments__c != null || mem.Comments__c != '')
              {
                      Case newCase = new Case(subject='Material',Status='New',Origin='Web');           
                      insert newCase;

              }
          }

      }

      How to convert String to Id?

      Sample Code:

      String a = 'adfh123edrftghu789';
      Id i = Id.valueOf(a);

      here String 'a' should be a valid record id. We cannot generate Salesforce Id using this method because Salesforce Id is system generated Id and it cannot be generated by us.


      Cheers!!!

      How to use Custom Labels in Visualforce page and Apex Class

      Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. The values can be translated into any language Salesforce supports. Custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user's native language.

      You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length.

      1. Go to Setup --> App Setup --> Custom Labels.

      2. Click 'New Custom Label' Button.


      3. Fill in the details and Click 'Save' button.



      Calling Custom Label in Visualforce page:
       
      Use the global variable $Label to access the Custom Label value in Visualforce page.

      Sample Code:

      <apex:page standardController="Account" extensions="sample">
      <h1>Example for Custom labels</h1>
      <apex:outputLabel value="{!$Label.Sample}"/>
      </apex:page>



      Using Custom Label in Apex Class:

      Custom labels are called in Apex using System.Label.Label_name.

      Sample Code:

      String samp = System.Label.Sample;

      Cheers!!!

      Outbound Messaging in Salesforce

      Using Outbound Messaging a message is sent to the specified endpoint URL. The message contains the fields specified when you created the outbound message. Once the endpoint URL receives the message, it can take the information from the message and process it. To do that, you need to examine the outbound messaging WSDL. Salesforce must be configured to send outbound messages before the publisher will receive any data.

      When setting up the outbound message, be sure to define these settings.
      1. Endpoint URL
      2. Fields to send
      3. Include session ID
      1. Go to Build --> Create --> Workflow & Approvals --> Outbound Messages.


      2. Click "New Outbound Message" button.


      3. Select the object and click "Next" button.


      4. Enter the details and click "Save" button.


      5. Go to Build --> Create --> Workflow & Approvals --> Workflow Rules and click "New Rule".



      6. Select the object and click "Next" button.


      7. Enter the details and click "Save&Next" button.


      8. Click "Select Existing Action".


      9. Select the outbound message and click "Save" button.


      10. Click "Done" button.


      11. Click "Activate" button.


      Topics in Salesforce

      CRM - Customer Relationship Management 

      1.             What is CRM(Customer Relationship Management)?

      2.             CRM Basic entities

      3.             Sub Modules of CRM

      4.             Existing CRMs

      Salesforce.com Introduction

      1.             What is Salesforce.com?

      2.             Why Salesforce.com?

      3.             Different editions in Salesforce.com

      4.             How to sign up for Developer Edition?

      Salesforce.com Basic Navigations

      1.             What are Records?

      2.             What are Related Lists?

      3.             Action Column

      4.             Help Links

      Salesforce.com Level 1 - Administration of Salesforce.com

      1.             Types of Objects

                           1.1.           Standard Objects

                           1.2.           Custom Objects

      2.             Types of Fields

                           2.1.           Standard Fields

                           2.2.           Custom Fields

      3.             Types of Relationships

      4.             Field Dependency

      5.             Different types of Email templates

                           5.1.          Text

                           5.2.          HTML (using Letterhead)

                           5.3.          Custom (without using Letterhead)

                           5.4.          Visualforce

      6.             Custom application

      7.             Console application

      8.             Field Accessibility

      9.             Grant Login Access

      10.            Calendar

      11.            Console Tab

      12.            Trusted IP Ranges

      13.            Session Settings

      14.            Different types of tabs

                           14.1.           Custom Object Tab

                           14.2.           Web Tab

                           14.3.           Visualforce Tab

      15.            Field History Tracking in Salesforce

      16.            Feed Tracking

      17.            https://developer.salesforce.com/

      18.            http://trust.salesforce.com

      19.            View setup audit trail

      20.            Organization Wide Default

      21.            Roles

      22.            Role Hierarchy

      23.            Sharing Rules

      24.            Profiles

      25.            Permission Sets

      26.            Password Policies

      27.            Developer console

      28.            Validation Rules

      29.            Workflow rules

                           29.1.           Email Alert

                           29.2.           Task

                           29.3.           Field Update

                           29.4.           Outbound Message

      30.            Approval process

      31.            Reports and Dashboards

      32.            Scheduling reports

      33.            Report Types

      34.            Adding dashboards in Home page

      35.            Chatter

      36.            Chatter Desktop

      37.            Queues

      38.            Public Groups

      39.            Assignment Rules

      40.            Auto Response Rule

      41.            Views

      42.            Domain Registration

      43.            Search Layouts

                           43.1.           Search Results

                           43.2.           Lookup Dialogs

                           43.3.           Lookup Phone Dialogs

                           43.4.           Accounts Tab

                           43.5.           Accounts List View

                           43.6.           Search Filter Fields

      44.            Page Layout

      45.            Mini Console View

      46.            Mini Page Layout

      47.            Record Types

      48.            Apex Data loader tool

      49.            Force.com Explorer tool

      50.            Force.com Sites

      51.            Data Management

                           51.1.           Analytic Snapshots

                           51.2.           Import Accounts/Contacts

                           51.3.           Import Leads

                           51.4.           Import Solutions

                           51.5.           Import Custom Objects

                           51.6.           Data Export

                           51.7.           Storage Usage

                           51.8.           Mass Transfer Records

                           51.9.           Mass Delete Records

                           51.10.          Mass Transfer Approval Requests

                           51.11.          Mass Update Addresses

                           51.12.          Data Loader

      52.            MVC Pattern

      53.            Tags in Salesforce

      54.            Live Agent

      55.            Public Solutions

      56.            Chatter Answers

      57.            Entitlement Management

      58.            How to access Salesforce from all IP Ranges - App Exchange application

      59.            Mass Edit, Delete - App Exchange application

      60.            Login Hours restriction for Profiles

      61.            Edit, Delete and Clone Buttons

      62.            App Exchange

      63.            Chat Settings(Chat Window)

      64.            Email to Case

      65.            Web-to-Lead

      66.            Web-to-Case

      67.            Schema Builder

      68.            Visualforce page

      69.            Actions in Salesforce

      70.            How to expire all the users password in Salesforce?

      71.            How Salesforce login works?

      72.            Account, Opportunity and Case teams

      73.            Manual Sharing 

      74.            Renaming Tab Names and Labels

      75.            Dataloader.Io

      76.            Data.com

      77.            Merge tool

      78.            Chatter Approval Request

      79.            https://success.salesforce.com

      80.            Opportunity Split  

      81.            Workbench

      82.            Work.com

      82.            Multi-Tenant Architecture

      83.            Creating Custom Tab Style in Salesforce

      84.            Historical Trend Reporting

      85.            Splash Page creation

      86.            Escalation Rules

      87.            Adding Multiple Users

      88.            Account Hierarchy

      89.            Solution Categories

      Salesforce.com Level 2 - Development in Salesforce.com

      1.              Custom Settings

      2.              Visualforce Components

      3.              Difference between Developer, Configuration only and Full Sandboxes.

      4.              Adding controller to Visualforce page

      5.              Apex Classes

      6.              Custom Labels

      7.              Adding Error message in Visualforce page

      8.              Triggers

      9.              Unit testing

      10.             Batch Apex

      11.             Database.SavePoint and Database.Rollback

      12.             Force.com IDE installation

      13.             Salseforce to Salesforce connection

      14.             Calling Apex method from Custom Button

      15.             Java to Salesforce connection

      16.             Fetching data from another Salesforce organization

      17.             Date Picker in Visualforce page

      18.             With Sharing and Without Sharing in Apex Classes

      19.             List, Set and Map collection data types

      20.             Moving Components from one organization to another organization

      21.             Creating table in VF using apex:panelGrid

      22.             Standard Controller, Custom Controller and Extensions 

      23.             How to create a Sandbox in Salesforce?

      24.             How to login into Sandbox in Salesforce?

      25.             How to create Inbound Change set?

      26.             How to create Outbound Change set?

      27.             Adding help text for apex:inputText

      28.             Debugging Apex code

      29.             Try and Catch block

      30.             Governor Limits in Salesforce.com

      31.             Hide and Show in Visualforce page

      32.             Date and Datetime

      33.             SOQL

      34.             Coding Standard in Salesforce

      Salesforce Integration Document

      How to schedule a report

      1. Open the report.

      2. Click 'Schedule Future Runs...' link in 'Run Report' list button.



      3. Fill the data as per your request and click 'Save Schedule Report' button.



      Sample scheduled report email:




      Cheers!!!

      How to add Row limit and Dashboard settings for Tabular report

      Open the tabular report and click Filter list and select row limit


      Now click 'Dashboard Settings' button and select Name and value click 'Ok' button.




      The value field can be anyone of the following data types

      1. Number
      2. Currency
      3. Boolean

      Cheers!!!

      How to display multiple Dashboards in home page in Salesforce

      To display multiple Dashboards in home page, just add the charts to the space adjacent to the chart.


      Click 'Save' and check your home page now.

      Updating field using Javascript using a custom button

      1. Create a button with label 'Add Employee'.

      2. Select '

      3. Select 'Execute JavaScript' as a behaviour.

      4. Add the below code

      {!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}

      var newRecords = [];

      var a = new sforce.SObject("Account");

      a.id ="{!Account.Id}";
      a.NumberOfEmployees = {!Account.NumberOfEmployees} + 1;
      newRecords.push(a);

      result = sforce.connection.update(newRecords);

      window.location.reload();


      5. Click 'Save' button.

      6. Add the button to the page layout.




      It will increment the Employees.

      How to track field history in Salesforce

      To track field history in Salesforce, follow the below steps

      1. Select the object.
      2. In the Custom fields section, click 'Set History Tracking' button.


      3. Select the fields and click 'Save' button.


      4. Add History related list to the page layout to see the changes.




      To change the dashboard to be displayed in Home page in Salesforce

      To change the dashboard to be displayed in Home page in Salesforce, follow the below steps

      1. Click 'Customize page' link.


      2. Select the dashboard to be displayed.

      How to display Dashboard on home page in Salesforce

      Go to Setup-> App setup ->customize-> Home -> Home page layout -> DE Default, Click 'Edit' and check the 'Dashboard snapshot' checkbox and click 'Save' button.

      Fetching data from another Salesforce organization

      Step 1: Generate Partner WSDL.




      Save the generated Partner WSDL.

      Step 2: Generate Apex code using the generated Partner WSDL.

       




      Copy the generated code and create a new Apex Class.

      Note:
      In the generated code do the following changes.
      1. Change public partnerSoapSforceCom.DeleteResult[] delete(String[] ids)  to public partnerSoapSforceCom.DeleteResult[] deleteSObjects(String[] ids).
      2. Change public partnerSoapSforceCom.UpsertResult[] upsert(String externalIDFieldName,sobjectPartnerSoapSforceCom.sObject_x[] sObjects) to public partnerSoapSforceCom.UpsertResult[] upsertSObjects(String externalIDFieldName,sobjectPartnerSoapSforceCom.sObject_x[] sObjects).
      3. Change public partnerSoapSforceCom.MergeResult[] merge(partnerSoapSforceCom.MergeRequest[] request) to public partnerSoapSforceCom.MergeResult[] mergeSObjects (partnerSoapSforceCom.MergeRequest[] request).
      4. Change public partnerSoapSforceCom.SaveResult[] update(sobjectPartnerSoapSforceCom.sObject_x[] sObjects) to public partnerSoapSforceCom.SaveResult[] updateSObjects(sobjectPartnerSoapSforceCom.sObject_x[] sObjects).
      5. Change public partnerSoapSforceCom.UndeleteResult[] undelete(String[] ids) to public partnerSoapSforceCom.UndeleteResult[] undeleteSObjects(String[] ids).
      Step 3:  Create visual force page to get the following details

      • Login credentials
      • Object Names
      • Field Names
      • Records

      Sample Code:

      <apex:page controller="sfTosf" >

      <!-- Javascript -->
      <script type = "text/javascript">

          window.onload=function()      
          {         
              document.getElementById("objs").style.display = 'none';
              document.getElementById("fields").style.display = 'none';
              document.getElementById("records").style.display = 'none';
          };
         
          function callObjects()
          {
              document.getElementById("objs").style.display = '';
              CallLogin();
          }

          function callFields()
          {
              document.getElementById("fields").style.display = '';
              CallShowFields();
          }
         
          function callRecords()
          {
              document.getElementById("records").style.display = '';
              CallShowRecords();
          }
         
      </script>
      <!-- End of Javascript -->

      <apex:form >
          <!-- Action Status -->
          <apex:actionstatus id="actionStatus">
          <apex:facet name="start">
          <c:enhancedactionstatus BackColor="#efefef" borderColor="black" borderSize="3" height="50px" width="120px" Message="Loading..." messageStyle="color:darkred;font-size:11pt;font-weight:bold;"/>
          </apex:facet>
          </apex:actionStatus>
         
          <!-- Calling login() from Controller -->
          <apex:actionFunction name="CallLogin" action="{!login}" reRender="objs" status="actionStatus"/>   

          <!-- Calling showFields() from Controller -->
          <apex:actionFunction name="CallShowFields" action="{!showFields}" reRender="fields" status="actionStatus"/>
         
          <!-- Calling fetch() from Controller -->
          <apex:actionFunction name="CallShowRecords" action="{!fetch}" reRender="records" status="actionStatus"/>    

          <!-- Login Details -->
          <apex:pageblock title="Login" >
              <apex:pageblocksection columns="2">
                  <apex:outputLabel >Username:</apex:outputLabel>
                  <apex:inputtext value="{!userName}" />
                  <apex:outputLabel >Password:</apex:outputLabel>
                  <apex:inputsecret value="{!passWord}"  />          
                  <apex:outputLabel >Security Token:</apex:outputLabel>                       
                  <apex:inputsecret value="{!securityToken}"  />             
              </apex:pageblocksection>                      
              <apex:pageblockbuttons >
                  <apex:commandButton value="Login" reRender="objs" onclick="callObjects()"/>
              </apex:pageblockbuttons>           
          </apex:pageblock>
         
          <!-- Object Details -->
          <table id = "objs" width = "100%"><tr><td>
          <apex:pageblock id="objs" title="Object Selection">
              <apex:pageblocksection >
                  <apex:outputlabel >Select Object:</apex:outputlabel>
                  <apex:selectList value="{!objectName}" multiselect="false" size="1" onchange="callFields()" >
                      <apex:selectoptions value="{!ObjectNames}"/>
                  </apex:selectList>
              </apex:pageblocksection>
          </apex:pageblock>
          </td></tr></table>
         
          <!-- Fields Details -->
          <table id = "fields" width = "100%"><tr><td>
          <apex:pageblock id="fields" title="Fields Selection">
              <table cellspacing = "15">
                  <tr>
                      <td>
                          <apex:selectList multiselect="true" value="{!selectedFields}" size="7" >
                              <apex:selectoptions value="{!fields}"/>
                          </apex:selectList>
                      </td>
                      <td>
                          <apex:commandButton value=" >> " action = "{!addFields}" reRender = "fields" status="actionStatus"/><br/><br/><br/><br/>
                          <apex:commandButton value=" << " action="{!removeFields}" reRender="fields" status="actionStatus"/>  
                      </td>
                      <td>
                          <apex:selectList multiselect="true" value="{!checkedFields}" size="7">
                              <apex:selectoptions value="{!fieldsAvailable}"/>
                          </apex:selectList>
                      </td>               
                  </tr>
                  <tr>
                      <td colspan = "3" align = "center"><apex:commandButton value="Fetch" rerender="records" onclick="callRecords()"/></td>
                  </tr>
              </table>
          </apex:pageblock>
          </td></tr></table>
         
          <!-- Retrieved Records -->   
          <table id = "records" width = "100%"><tr><td>
          <apex:pageBlock id="records" title="Records">
              <apex:pageBlockTable value="{!output}" var="res">
                  <apex:column value="{!res}"/>
              </apex:pageBlockTable>
          </apex:pageBlock>
          </td></tr></table>  
           
      </apex:form>
      </apex:page>

      Step 4:  Write an apex class for controller to that visualforce page.

      Sample Code:

      public class sfTosf
      {
          public String userName {get;set;}   
          public String passWord {get;set;}
          public String securityToken {get;set;}  
          public String objectName {get;set;}
          public String[] objNames = new String[]{'None'};
          public List<String> fieldNames = new List<String>();
          public List<String> availableFieldNames = new List<String>();
          public sobjectPartnerSoapSforceCom.sObject_x[] values;  
          public List<String> output {get; set;}
          public integer i {get;set;}
          public integer j = 0;
             
          /* String array for select box(Fields) */
          String[] selectedFields = new String[]{};
          String[] checkedFields = new String[]{};
         
          public partnerSoapSforceCom.Soap con = new partnerSoapSforceCom.Soap();
         
          public void login()
          {
              if(checkLogin())
              {
                  retrieveObjects();
              }
          }
         
          public boolean checkLogin()
          {
              try
              {                                 
                  partnerSoapSforceCom.LoginResult loginResult = con.login(username, (password+securityToken));                   
                  con.SessionHeader = new partnerSoapSforceCom.SessionHeader_element();       
                  con.endpoint_x =loginResult.ServerUrl;       
                  con.Sessionheader.sessionid = loginResult.sessionid;
              }
              catch(Exception e)
              {
              }
              return true;
           }
          
           /* Retrieving all the objects */
           public void retrieveObjects()
           {
               if(checkLogin())
               {
                   partnerSoapSforceCom.DescribeGlobalresult sobjectResults = con.describeGlobal();
                   partnerSoapSforceCom.DescribeGlobalSObjectResult[] objects = sobjectResults.sobjects;        
                   for(partnerSoapSforceCom.DescribeGlobalSObjectResult tmpRes:objects)
                   {
                       objNames.add(tmpRes.Name);
                   }
               }
           }
          
           /* Getting the selected object name */
           public String getobjectName()    
           {     
               return objectName;   
           }       
           public void setobjectName(String obj)    
           {     
               this.objectName = objectName;    
           }
           
           public List<SelectOption> getobjectNames()   
           {         
               List<SelectOption> options = new List<SelectOption>();
               for(String temp:objNames)
               {    
               options.add(new SelectOption(temp,temp));
               }     
               return options;   
           }
          
           public void showFields()
           {
               if(checkLogin())
               {
                   partnerSoapSforceCom.DescribeSObjectResult descObjRes = con.describeSObject(objectName);
                   partnerSoapSforceCom.Field[] fields = descObjRes.Fields;
                   for(partnerSoapSforceCom.Field tmpRes:fields)
                   {
                       fieldNames.add(tmpRes.Name);               
                   }                    
               }        
           }
          
           /* Getting the all the field names */
           public List<String> getselectedFields()    
           {     
               return selectedFields;   
           }       
           public void setselectedFields(List<String> selectedFields)    
           {     
               this.selectedFields = selectedFields;   
           }
                
           public List<SelectOption> getfields()   
           {         
               List<SelectOption> options = new List<SelectOption>();
               fieldNames.sort();
               for(String temp:fieldNames)
               {    
               options.add(new SelectOption(temp,temp));
               }     
               return options;   
           }
          
           /* Getting the all the field names */
           public List<String> getcheckedFields()    
           {     
               return checkedFields;   
           }       
           public void setcheckedFields(List<String> checkedFields)    
           {     
               this.checkedFields = checkedFields;   
           }
                
           public List<SelectOption> getfieldsAvailable()   
           {         
               availableFieldNames.sort();
               List<SelectOption> options = new List<SelectOption>();
               for(String temp:availableFieldNames)
               {    
                   options.add(new SelectOption(temp,temp));
               }     
               return options;   
           }
          
           public void addFields()
           {
               for(String tmp:selectedFields)
               {
                   availableFieldNames.add(tmp);
                   for(i = 0; i<fieldNames.size(); i++)
                   {
                       if(fieldNames[i] == tmp)
                       {
                           fieldNames.remove(i);
                           break;
                       }
                   }                         
               }
           }   
          
           public void removeFields()
           {
               integer i;
               for(String tmp:checkedFields)
               {
                   fieldNames.add(tmp);
                   for(i = 0; i<availableFieldNames.size(); i++)
                   {
                       if(availableFieldNames[i] == tmp)
                       {
                           availableFieldNames.remove(i);
                           break;
                       }
                   }                         
               }
           }
           public void fetch()
           {
               if(checkLogin())
               {
                   integer availableFieldNamesLen = availableFieldNames.size();
                   String fieldsToQuery = '';
                   for(String temp:availableFieldNames)
                   {
                       if(j != (availableFieldNameslen - 1))
                       {
                           fieldsToQuery = fieldsToQuery + temp + ',';
                       }
                       else
                       {
                           fieldsToQuery = fieldsToQuery + temp;
                       }                
                       j = j +1;
                   }
                   String sql = 'SELECT ' + fieldsToQuery + ' FROM ' + objectName;              
                      
              
                   /*-----------------------------------
                   Login via SOAP/XML web service api
                  -----------------------------------*/
                  HttpRequest request = new HttpRequest();
                  request.setEndpoint('https://www.salesforce.com/services/Soap/u/22.0');
                  request.setMethod('POST');
                  request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
                  request.setHeader('SOAPAction', '""');
                  /*not escaping username and password because we're setting those variables above
                  in other words, this line "trusts" the lines above
                  if username and password were sourced elsewhere, they'd need to be escaped below*/
                  request.setBody('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><login xmlns="urn:partner.soap.sforce.com"><username>' + userName+ '</username><password>' + passWord + securityToken + '</password></login></Body></Envelope>');
                  Dom.XmlNode resultElmt = (new Http()).send(request).getBodyDocument().getRootElement()
                    .getChildElement('Body', 'http://schemas.xmlsoap.org/soap/envelope/')
                    .getChildElement('loginResponse', 'urn:partner.soap.sforce.com')
                    .getChildElement('result', 'urn:partner.soap.sforce.com');
         
                  /*-------------------------------
                   Grab session id and server url
                  --------------------------------*/
                  final String SERVER_URL = resultElmt.getChildElement('serverUrl', 'urn:partner.soap.sforce.com') .getText().split('/services')[0];
                  final String SESSION_ID = resultElmt.getChildElement('sessionId', 'urn:partner.soap.sforce.com') .getText();
         
                  /*----------------------------------
                   Load first 20 accounts via REST API
                  ---------------------------------*/
                  final PageReference theUrl = new PageReference(SERVER_URL + '/services/data/v22.0/query/');
                  theUrl.getParameters().put('q',sql);
                  request = new HttpRequest();
                  request.setEndpoint(theUrl.getUrl());
                  request.setMethod('GET');
                  request.setHeader('Authorization', 'OAuth ' + SESSION_ID);
         
                  String body = (new Http()).send(request).getBody();
         
                  JSONParser parser = JSON.createParser(body);
         
                  do
                  {
                      parser.nextToken();
                  }
                  while(parser.hasCurrentToken() && !'records'.equals(parser.getCurrentName()));
         
                  parser.nextToken();
         
                  List<String> tmpOutput = (List<String>) parser.readValueAs(List<String>.class); 
                  //output = tmpOutput;                   
                  List<String> tempoutput = new List<String>();
                  for(String tmp:tmpOutput)
                  {
                      if(tmp != null)
                      {
                          if(!tmp.contains('attributes') && !tmp.contains('type') && !tmp.startsWith('/services/data/v22.0') && !tmp.contains('url') && tmp != objectName && !tmp.contains('{') && !tmp.contains('}'))
                          {
                              tempoutput.add(tmp);
                          }
                      }
                  }
                  output = tempoutput;
              } 
           } 
      }

      Step 5:  Create a custom component for action status with name “enhancedactionstatus”.
      To create custom component, Setup à Develop à Components


      enhancedactionstatus custom component

      Sample Code:
      <apex:component >
      <!-- Attribute Definitions -->
      <apex:attribute name="BorderColor" type="String" required="true" description=""></apex:attribute>
      <apex:attribute name="Width" type="String" required="true" description=""></apex:attribute>
      <apex:attribute name="Height" type="String" required="true" description=""></apex:attribute>
      <apex:attribute name="BackColor" type="String" required="true" description=""></apex:attribute>
      <apex:attribute name="BackColor" type="String" required="true" description=""></apex:attribute>
      <apex:attribute name="BorderSize" type="String" required="true" description=""></apex:attribute>
      <apex:attribute name="ImageUrl" type="String" required="false" description=""></apex:attribute>
      <apex:attribute name="Message" type="String" required="false" description=""></apex:attribute>
      <apex:attribute name="messageStyle" type="String" required="false" description="Message inline style">
      </apex:attribute>
      <apex:attribute name="BorderStyle" type="String" 
      required="false" description="Message box border style: solid, outset, inset, etc"></apex:attribute>
       
      <div id="salesforceSource_blurybackground" style="position:absolute; left:1px; top:1px; 
      width:100%; height:100%; text-align:center; vertical-align: 
      middle; background-color: #303030; opacity:0.6; filter:alpha(opacity=50)">
      </div>
       
      <div id="salesFroceSource_StatusBox" 
      style="position:absolute; left:100px; top: 100px;width: {!Width}; height:{!Height}; filter:alpha(opacity=100)">
      <table border="{!BorderSize}" cellpadding="0" cellspacing="0" style="border-left-color: {!BorderColor};
      border-bottom-color: {!BorderColor}; width: {!Width}; border-top-color: {!BorderColor}; height:{!Height};
      border-right-color:{!BorderColor}; border-style:{!BorderStyle}; background-color:{!BackColor};">
      <tr>
      <td align = "center" style="border-bottom-color:{!BorderColor}; border-bottom-width:1px; 
      border-bottom-style:solid;vertical-align:middle;{!messageStyle}">
      &nbsp;{!Message}
      </td>
      </tr>
      </table>
      </div>
       
      <script type="text/javascript">
      var AgreementForm = document.getElementById("salesforceSource_blurybackground");
      AgreementForm.style.height = window.screen.availHeight + "px";
      AgreementForm.style.width = window.screen.availWidth + "px";
       
      var ContainerElem = document.getElementById("salesFroceSource_StatusBox");
      //ContainerElem.style.display = "block";
      AlignToCenter(ContainerElem);
       
      function AlignToCenter(Element)
      {
      var availableHeight = 0;
      var availableWidth = 0;
      if (Element.ownerDocument)
      {
      var docElement = Element.ownerDocument.documentElement;
      availableHeight = parseInt(docElement.clientHeight);
      if (availableHeight == "NaN") availableHeight = 0;
       
      availableWidth = parseInt(docElement.clientWidth);
      if (availableWidth == "NaN") availableWidth = 0;
      }
       
      if (availableHeight == 0 || availableHeight == "NaN")
      availableHeight = window.screen.availHeight - 200;
      if (availableWidth == 0 || availableWidth == "NaN")
      availableWidth = window.screen.availWidth - 100;
       
      var msgBoxTop = parseInt((availableHeight - parseInt(Element.clientHeight))/2);
      var msgBoxleft = parseInt((availableWidth - parseInt(Element.style.width))/2);
       
      if (msgBoxTop == "NaN" || msgBoxTop == 0)
      msgBoxTop = 100;
       
      Element.style.left = msgBoxleft + "px";
      Element.style.top = msgBoxTop + "px";
      }
      </script>
      </apex:component>

      Output: