Discovery

The discovery features of WireBootstrap data sources allow a data service to tell consumes about what information the data service can supply.

Discovery calls to Salesforce in WireBootstrap for meta data use the object resource of the REST API. For details on this resource, visit Working with Meta Data.

Objects

Use the discoverEntitiesAsync method on a data source to get a list of objects (entities) in Salesforce.

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

const tblEntities = await.source.discoverEntitiesAsync();

Discover results are returned in a WireBootstrap DataTable object.

...

const tblEntities = await.source.execAsync(query);

// grab an array of the first 10 objects ordered by name
const rows = tblEntities.select().top(10).orderBy("Name").rows();

To filter the call to a single object, use the optional configuration parameter setting the entity property to the name of the object.

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

const tblEntities = await.source.discoverEntitiesAsync({
    entity: "Account"
});

Fields

Use the discoverFieldsAsync method on a data source to get a list of fields for an object in Salesforce. Pass the name of the entity in the entity property of the configuration parameter.

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

const tblFields = await.source.discoverFieldsAsync({
    entity: "Account"
});

Results

The datatable returned from discover calls contains the list of records requested from Salesforce. However, the response returned from Salesforce contains much more data than can be represented in a WireBootstrap datatable.

The service provider for the WireBootstrap for Salesforce Data Connector has an extension method called results which will return the raw results from the last call to Salesforce.

...
const tblEntities = await.source.discoverEntitiesAsync();

const results = source.serviceProvider().results();

For more on service provider extensions methods, visit Provider Extensions.

Last updated