Queries
Salesforce queries in WireBootstrap use the query
resource of the REST API to execute SOQL in Salesforce. For details on this resource, visit Execute a SOQL Query.
Creating Queries
To create a query against Salesforce in WireBootstrap, use the standard table query interface in WireBootstrap.
For example, to request a list of account records, use the Account
entity.
const query = wire.data.select().from("Account");
To filter the accounts returned, use the where
method with a filter expression method.
const query = wire.data.select().from("Account")
.where().eq("Active__c", "Yes");
The where
method also takes an optional string parameter to create custom filters.
const query = wire.data.select().from("Account")
.where("Name LIKE 'United*'");
Execute Queries
After creating a query, execute the query in Salesforce using the execAsync
method on the data source.
const source = new wire.data.DataSource("sf", {
...
});
const tblAccounts = await source.execAsync(query);
Query results are returned in a WireBootstrap DataTable object.
...
const tblAccounts = await.source.execAsync(query);
// grab an array of the first 10 account objects ordered by account name
const rows = tblAccounts.select().top(10).orderBy("Name").rows();
Results
The datatable returned from the query 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 Salesforce query.
...
const tblAccounts = await.source.execAsync(query);
const results = source.serviceProvider().results();
For more on service provider extensions methods, visit Provider Extensions.
Last updated