Salesforce Dynamically Adding/Deleting rows in visualforce

Addition or removal of line items can be done dynamically on click of a button without refreshing the complete page. It can be achieved easily by using the reRender attribute of the visualforce component.

Below code is a simple example which shows Contacts linked to an Account. User can delete or add multiple contacts to an account by clicking the “Add Attendee” button. The code uses a index called rowNumber which keeps track of the row number to be deleted.

Visualforce Page :

<apex:page standardController="Account" extensions="addAttendee" sidebar="false">
 <apex:form >
 <apex:pageBlock title="Accounts" id="pb">
 <apex:pageMessages />
 <apex:variable var="rowNumber" value="{!0}"/>
 <apex:pageblockSection columns="1">
 <apex:pageBlockTable title="Contacts" var="acc" value="{!attendeeList}"> 
 Continue reading 

Salesforce 15 Digit vs 18 Digit ID

Salesforce uses a 15/18 digits unique id to identify each record. These ids which we can see in the URL are 15 digit case sensitive id whereas the API returns an 18 digit case insensitive id.

The reason why we needed an 18 digit id was due to limitations in Excel VLOOKUP formulas and many legacy systems, which works only with case insensitive ids. The last 3 digits are checksum of the 15 digits ID

Understanding the conversion of 15 to 18 digit ID – Continue reading

Salesforce Integration With Java

Ever wondered how we can access the Salesforce Object’s data inside java classes. To achieve the functionality, we need to integrate Salesforce with Java.

Below mentioned are the steps to establish a connection between Salesforce and Java.

  • We need an enterprise WSDL, which can be downloaded from Salesforce instance, Setup>Develop>API>Generate Enterprise WSDL.
  • We need to convert the downloaded WSDL to JAR file in order to import it into Eclipse User Library.
  • To convert it, we need wsc-xx.jar file. This file can be downloaded from http://code.google.com/p/sfdc-wsc/downloads/list . Make sure to chose the correct version of jar file according to your JDK version.
  • To generate the stub code, we need to go to terminal or cmd for Windows. Continue reading