Category Archives: VisualForce

Creating multiple tabs for same Salesforce Object

Many time I have seen Salesforce Admins wants multiple tabs for same object depending upon the RecordTypes or some other criteria like separate tabs for Premium Account, Gold Accounts and Silver. Indeed they can create multiple views and use the picklist and use “Go” button. But it has disadvantage like multiple clicks, not that user friendly.

In short there is no direct way of creating multiple tabs for same object in Salesforce. Then I thought of creating an Apex component which will take some inputs like ObjectName, Fields to display and criteria/Filter. This appraoch was needing too much of coding and generic code writing for supporting it for all objects. And it was limited to the query filter one can have.

Creating multiple views is the feature inbuilt provided by the Salesforce and is very powerful. So I thought to use the apex:enhancedList control which takes the viewId as a parameter. You can find the documentation for the EnhancedList here. The most important thing is apex:enhancedlist only requires the viewid.

I created a simple VisualForce Page like below.

<apex:page >
<apex:enhancedList height=”600″ rowsPerPage=”25″ id=”AccountList” listid=”{!$CurrentPage.Parameters.viewId}” customizable=”false”/>

I wanted to reuse this page so I didn’t added any standard controller to the Page itself.

Then now comes the step of creating the Tabs. Sample purpose I am taking Account’s views.

Salesforce support following three types of tab creation:

  1. Custom Object Tabs: – Not suitable to above approach.
  2. VisualForce Tabs: – This will work but do not allow passing the parameters from the URL, so this will not allow reuse of the same page.
  3. Web Tabs: – This allows any URL integration into the tab and suits requirement.
Complex task is to find the viewId. I didnt found it straight forward.
Creating the Tab now:
Now add this tab to your SelectedTabs.

Showing the Processing/Loading image

I came across a good code sample while surfing for showing the Loading/Processing  image on the VisualForce Page.

You can find it at:


I was constantly getting exception when I tried to use the “/soap/ajax/15.0/connection.js” in the VF Page.
JavaScript throws following exception:-

Invalid SessionID

{faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{UnexpectedErrorFault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }

The exception was resolved when I added following statement before using the “sforce.connection” object in the JavaScript.

sforce.connection.sessionId = “{!$Api.Session_ID}


Salesforce Flex: “Error #2032: Stream Error. URL: “

I came across the Error #2032 exception when I was trying to embed the swf file uploaded to static resources of the Salesforce instance. I searched it on the as well as google it around but didnt find any solution. but after that i realized that the swf file is unable to find the force toolkit required for the execution of the swf file.

I solved this by right clicking on the project in eclipse then on going to the properties.  And configuring the Framework linkage to merge in code value. I dont know this was the correct way to do that or not.