How are the Classic and Lightning Console APIs Different?
Console Integration Toolkit versus Lightning Console JavaScript API
Both the Lightning Console JavaScript API and the Salesforce Console Integration Toolkit are JavaScript APIs that allow you to interact with Classic or Lightning console apps. Methods are implemented differently in each API, however.
Here’s what’s different between the Lightning Console JavaScript API and the Salesforce Console Integration Toolkit.
- You Use the Methods in Different Places
-
- In Aura components, use the Lightning Console JavaScript API methods in the JavaScript controller of a Lightning component.
- In Lightning web components, you can use only the utility bar and workspace API methods, wire adapters, and Lightning message channels. Lightning web components don’t currently support working with navigation items.
- Visualforce or iframed, third-party pages work in both Lightning Experience and
Salesforce Classic. For Visualforce and iframe pages, use the Classic methods from the
Salesforce Console Integration Toolkit. However, there are limitations regarding which
methods you can use. Classic Console API Methods Supported in the Lightning Console API, provides details on the
supported methods.
When you are using the Salesforce Console Integration Toolkit in Salesforce Classic, you use methods within <script> tags for Visualforce pages or iframed, third-party pages.
- The Input Syntax for Methods is Different
-
Methods in the Lightning Console JavaScript API (Aura components) take a JSON array of arguments:
workspace.openTab({ url: '#https://salesforce.com', focus: true, label: 'Salesforce', });
Similarly, methods in the Lightning Console JavaScript API (LWC) take a JSON array of arguments:openTab({ url: '#/sObject/001R0000003HgssIAC/view', label: 'Global Media', focus: true })
Methods in the Salesforce Console Integration Toolkit don’t:sforce.console.openPrimaryTab(null, 'https://salesforce.com', false, 'salesforce', openSuccess, 'salesforceTab');
- The APIs Provide Different Methods
-
Although some of the methods in the Lightning Experience methods are similar to the Salesforce Classic methods, they have different names and provide different functionality.
The Lightning Console JavaScript API also provides methods for use with the utility bar, which is available in Lightning Experience only.