Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface LoadOptions

    Options for loading objects from the Lime CRM database.

    LoadOptions defines how to query objects when using LimeObjectRepository methods like loadObjects and loadRelations. Supports filtering, sorting, pagination, and selecting specific properties to load.

    This provides a simpler interface compared to Query, with automatic state management and integration with the component platform.

    import { Operator, PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);

    const response = await repository.loadObjects('deal', {
    filter: { key: 'status', op: Operator.EQUALS, exp: 'active' },
    order: [{ name: 'value', direction: 'DESC' }],
    limit: 50,
    });

    const deals = response.objects;
    interface LoadOptions {
        filter?: Expression;
        includeTotals?: boolean;
        limit?: number;
        offset?: number;
        order?: PropertyOrder[];
        properties?: (string | AggregateProperty)[];
    }
    Index

    Properties

    filter?: Expression

    Filter expression to limit which objects are returned.

    Build complex filter criteria using Expression with operators like AND, OR, NOT, and comparison operators. Leave undefined to load all objects.

    import { LoadOptions, Operator } from '@limetech/lime-web-components';

    const options: LoadOptions = {
    filter: {
    key: 'status',
    op: Operator.EQUALS,
    exp: 'active',
    },
    };
    import { LoadOptions, Operator } from '@limetech/lime-web-components';

    const options: LoadOptions = {
    filter: {
    op: Operator.AND,
    exp: [
    { key: 'status', op: Operator.EQUALS, exp: 'active' },
    {
    op: Operator.OR,
    exp: [
    { key: 'priority', op: Operator.EQUALS, exp: 'high' },
    { key: 'value', op: Operator.GREATER, exp: 50_000 },
    ],
    },
    ],
    },
    };
    includeTotals?: boolean

    Whether to include totals (totalCount, totalRelations, aggregates) in the response. Set to false to skip the extra COUNT query on the server, which can significantly improve performance for large datasets.

    When false, totalCount and totalRelations will be null in the response. Use a separate request with limit: 0 to fetch totals without object data.

    Maps to the ?includeTotals=false query parameter. Defaults to true.

    limit?: number

    Maximum number of objects to load.

    Use this with offset for pagination. If omitted, a default limit will be applied by the backend.

    offset?: number

    Number of objects to skip before starting to return results.

    Use this with limit for pagination. For example, limit=50 and offset=100 will return objects 101-150.

    order?: PropertyOrder[]

    Properties to sort results by.

    Specify one or more properties with their sort direction (ASC or DESC). Objects will be sorted in the order specified, with earlier entries taking precedence.

    import { LoadOptions } from '@limetech/lime-web-components';

    // Sort by priority ascending, then value descending
    const options: LoadOptions = {
    order: [
    { name: 'priority', direction: 'ASC' },
    { name: 'value', direction: 'DESC' },
    ],
    };
    properties?: (string | AggregateProperty)[]

    Properties to load on the objects.

    Specify which properties to include in the loaded objects. This can improve performance by only loading needed data. Can include:

    • Simple property names (strings)
    • Aggregate properties for calculating statistics

    If omitted, all properties will be loaded.

    import { LoadOptions } from '@limetech/lime-web-components';

    const options: LoadOptions = {
    properties: ['name', 'status', 'value', 'company.name'],
    };
    import { AggregateOperator, LoadOptions } from '@limetech/lime-web-components';

    const options: LoadOptions = {
    properties: [
    'name',
    'value',
    {
    name: 'deals.value',
    key: 'total_deal_value',
    operator: AggregateOperator.Sum,
    },
    ],
    };

    AggregateProperty for aggregate definitions