Salesforce Console Integration Toolkit

Salesforce Console Integration Toolkit

The Salesforce console is designed for users in fast-paced environments who need to find, update, and create records in Salesforce quickly. The Salesforce Console Integration Toolkit provides you with programmatic access to the Salesforce console so that you can extend it to meet your business needs. With the Salesforce Console Integration Toolkit, you can open and close tabs in the console to streamline a business process. For example, the toolkit lets you integrate third-party systems with the console, opening up an external application in the same window, in a tab.

1. Create a Visualforce page with the below code.

Sample Visualforce page:

<apex:page standardController=”Case”>


    <apex:includeScript value=”/support/console/39.0/integration.js”/>
    <script type=”text/javascript”>
        /* Opens Case’s Contact in primary tab */
        function openPrimaryTab() {
            sforce.console.openPrimaryTab(undefined, 
            ‘{!$Site.BaseUrl}/{!Case.Contact.Id}’, true, ‘Contact’);
        }


        /* Opens Case’s Contact in sub tab */
        var callOpenSubtab=function callOpenSubtab(result) {
            sforce.console.openSubtab(result.id, 
            ‘{!$Site.BaseUrl}/{!Case.Contact.Id}’, true, ‘Contact’);
        };


        function openSubtab() {
            sforce.console.getEnclosingPrimaryTabId(callOpenSubtab);
        }


        //Sets the title of the current tab to “Example”
        function setTitle() {
            sforce.console.setTabTitle(‘Example’);
        }


        //The callback function that closeTab will call once it has the ID for its tab
        var callCloseTab= function callCloseTab(result) {
            sforce.console.closeTab(result.id);
        }


        function closeTab() {
            sforce.console.getEnclosingTabId(callCloseTab);
        }
    </script>


    <A HREF=”#” onClick=”openPrimaryTab();return false”>Open A Primary Tab</A> 
    <p/><A HREF=”#” onClick=”openSubtab();return false”>Open A Subtab</A> 
    <p/><A HREF=”#” onClick=”setTitle();return false”>Set Title to Example</A> 
    <p/><A HREF=”#” onClick=”closeTab();return false”>Close This Tab</A> 


</apex:page>

2. Go to Buttons, Links, and Actions under Case.

2. Click “New Button or Link”.

3. Save it.

4. Add it to the Case page layout.

5. Open a Case record and Click the link.

Set Title to Example:




Open A Subtab:




Open A Primary Tab:


Leave a Reply