Execute a query and return matching objects.
Sends a query to the Lime CRM backend and returns the matching objects along with any requested aggregate calculations. The query can include complex filter expressions, sorting, pagination, and aggregations.
The response type is inferred from the query's responseFormat. Define
the query inline or with satisfies Query to keep the literal shape that
drives the inference.
Query configuration defining what to retrieve
Promise resolving to the query results
import { Operator, PlatformServiceName } from '@limetech/lime-web-components';
const queryService = platform.get(PlatformServiceName.Query);
const response = await queryService.execute({
limetype: 'company',
limit: 100,
filter: {
key: 'city',
op: Operator.EQUALS,
exp: 'Stockholm',
},
orderBy: [{ name: 'name', direction: 'ASC' }],
responseFormat: {
object: { name: null },
},
});
for (const company of response.objects) {
console.log(company.name);
}
Service for executing queries using the query objects API.
The QueryService provides direct access to the Lime CRM query engine, allowing you to execute complex queries with filtering, sorting, pagination, and aggregation. This is the most powerful way to query objects when you need advanced filtering or aggregation capabilities.
When to use QueryService vs LimeObjectRepository:
Example: Get active deals
Example: Complex query with pagination and aggregates
Example: Query with nested AND/OR logic
See