Data Connector

The Salesforce REST API is a data service that allows object data and meta data in Salesforce to be securely accessed by custom applications.

The WireBootstrap for Salesforce Data Connector is a WireBootstrap data connector that can talk to Salesforce using the Salesforce REST API.

Using the data connector, Salesforce objects can be queried from WireBootstrap applications. The data connector also provides access to Salesforce meta data such as lists of objects and their fields using WireBootstrap's data discovery features.

Data Source

To use the data connector, create a WireBootstrap data source using the connector's service provider key in the initialization. The service provider key for the WireBootstrap for Salesforce Data Connector is sf.

const source = new wire.data.DataSource("sf", {
    ...
});

Authentication

For security, the Salesforce REST API requires an access token. For details on creating a Salesforce access token, visit Access Tokens.

Below is a sample access token object returned from a call to Salesforce for a token.

const response = {
    instance_url: "https://domain-dev-my.salesforce.com",
    access_token: "eyJ0e...Agjmg"
    token_type: "Bearer"
}

To set up the security for data source calls, use the Headers property during the data source initialization. Set Authorization property using the token response object returned from Salesforce.


const source = new wire.data.DataSource("sf", {
    Headers: { Authorization: response.token_type + " " + reponse.access_token },
    ...      
});

Service Root

Use the ServiceRoot configuration property on the data source to specify the end point for the Salesforce REST API. This will be in the instance_url property on the token response object.

const source = new wire.data.DataSource("sf", {
    ServiceRoot: response.instance_url,
    ...
});

CORS

CORS must be configured in Salesforce to allow the WireBootstrap for Salesforce Data Connector to access data returned from calls to Salesforce from a web browser.

For details visit, Configure Salesforce CORS Allow List.

Last updated