---
schema_version: "1"
id: b2217f661769c08a065c8c1d892d8588ebfa1a4571075772a8f2f19c800613f5
title: Add Tableau Next Components from Multiple Salesforce Orgs
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/sdk/guides/sdk-integration-multiple-orgs.md
canonical_url: https://developer.salesforce.com/docs/analytics/sdk/guide/sdk-integration-multiple-orgs.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6b38c5599be2975ca85d1782a25fbba92217bad841321ed4c003f744bf5b8f02
products:
  - Tableau Next Embedding SDK
  - analytics
---
# Add Tableau Next Components from Multiple Salesforce Orgs

Embedding Tableau Next components in your own web app gives you the flexibility to add components from multiple Salesforce orgs on one page.

To use multiple orgs in your implementation, initialize the SDK with the `orgConfigs` map instead of single `orgUrl` and `authCredential` parameters.

```javascript
import {
  initializeAnalyticsSdk,
  AnalyticsDashboard,
  AnalyticsVisualization,
} from "@salesforce/analytics-embedding-sdk";

// Initialize with multiple orgs, Lightning URL required for the `orgUrl` values
const initPayload = {
  orgConfigs: [
    {
      orgUrl: "https://org1.lightning.force.com",
      authCredential: "https://org1-frontdoor.salesforce.com/...",
    },
    {
      orgUrl: "https://org2.lightning.force.com",
      authCredential: "https://org2-frontdoor.salesforce.com/...",
    },
  ],
};

const response = await initializeAnalyticsSdk(initPayload);
```

Then, when you embed your components, you must specify the `orgUrl` in the component constructor. The `orgUrl` is required when creating components in a multi org scenario, to ensure that your component connects to the correct org.

```javascript
// Embed components from different orgs - always specify orgUrl
const dashboard = new AnalyticsDashboard({
  parentIdOrElement: "container1",
  idOrApiName: "Dashboard1",
  orgUrl: "https://org1.lightning.force.com",
});
dashboard.render();

// Embed visualization from another org
const visualization = new AnalyticsVisualization({
  parentIdOrElement: "container2",
  idOrApiName: "Viz2",
  orgUrl: "https://org2.lightning.force.com",
});
visualization.render();
```

## Adding Orgs Dynamically

You can add new orgs or try failed orgs again after the initial SDK initialization by using the `retryOrAddOrgs` function.

```javascript
import { retryOrAddOrgs } from "@salesforce/analytics-embedding-sdk";

const newOrgs = [
  {
    orgUrl: "https://org3.lightning.force.com",
    authCredential: "https://org3-frontdoor.salesforce.com/...",
  },
  {
    orgUrl: "https://org4.lightning.force.com",
    authCredential: "https://org4-frontdoor.salesforce.com/...",
  },
];
const response = await retryOrAddOrgs(newOrgs);

// Check if orgs were added successfully
console.log(response.status);
```

The `retryOrAddOrgs` function returns the same `BootstrapResponse` format as the `initializeAnalyticsSdk` function.

## Response

The `initializeAnalyticsSdk` function returns a `BootstrapResponse` object, which contains an `orgStates` map with the overall status and the individual org statuses.

```javascript
const response = await initializeAnalyticsSdk(config);

// Response structure:
{
    "message": "Sdk Initialize Complete",
    "status": "Success",
    "orgStates": {
        "https://org1.lightning.force.com": {
            "state": "INITIALIZATION_SUCCESS",
            "reason": ""
        },
        "https://org2.lightning.force.com": {
            "state": "INITIALIZATION_SUCCESS",
            "reason": ""
        }
    }
}
// Check initialization status
console.log(response.status);
// Get detailed message
console.log(response.message);

// For multi-org scenarios, check individual org states:
if (response.orgStates) {
    response.orgStates.forEach((state, orgUrl) => {
        console.log(`Org ${orgUrl}: ${state.state}`);
    });
}
```

### SDK Initialization Status Values

- `Status.SUCCESS` - All orgs initialized successfully
- `Status.PARTIAL_SUCCESS` - Some orgs initialized successfully (multi-org only)
- `Status.FAILURE` - Initialization failed

**See Also**

- [`initializeAnalyticsSdk`](/docs/analytics/sdk/references/sdk-js-v2/initializeAnalyticsSdk.html)
- [`retryOrAddOrgs`](/docs/analytics/sdk/references/sdk-js-v2/retryOrAddOrgs.html)
- [`OrgConfig`](/docs/analytics/sdk/references/sdk-js-v2/OrgConfig.html)
- [`OrgStateMap`](/docs/analytics/sdk/references/sdk-js-v2/OrgStatesMap.html)
- [`OrgStateInfo`](/docs/analytics/sdk/references/sdk-js-v2/OrgStateInfo.html)
