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

    Interface LimeObjectBulkCommand

    A command that operates on multiple LimeObjects of a single LimeType.

    LimeObjectBulkCommand is used for batch operations on multiple records, such as exporting selected deals to Excel, sending bulk emails, or mass-updating status fields. The filter property determines which objects are included in the operation.

    Important: Do not assume a specific filter structure in your command handler. The filter expression can vary depending on the user's selection:

    • Specific selection: { key: 'id', op: 'IN', exp: [1, 2, 3] } (selected rows)
    • Select all with criteria: { key: 'status', op: '=', exp: 'won' } (filtered view)
    • Select all: null (all objects in the limetype)

    Always pass the filter to your data queries rather than parsing its structure.

    import {
    Command,
    Expression,
    LimeObjectBulkCommand,
    LimeTypeContext,
    } from '@limetech/lime-web-components';

    @Command({ id: 'export-to-excel' })
    class ExportToExcelCommand implements LimeObjectBulkCommand {
    public context: LimeTypeContext;
    public filter: Expression | null;
    public includeRelations = false;
    }

    const command = new ExportToExcelCommand();
    command.context = { limetype: 'deal', id: null };
    command.filter = null;
    import {
    Command,
    Expression,
    LimeObjectBulkCommand,
    LimeTypeContext,
    Operator,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    @Command({ id: 'export-to-excel' })
    class ExportToExcelCommand implements LimeObjectBulkCommand {
    public context: LimeTypeContext;
    public filter: Expression | null;
    public includeRelations = false;
    }

    const commandBus = platform.get(PlatformServiceName.CommandBus);

    const selectedRows: Expression = {
    key: 'id',
    op: Operator.IN,
    exp: [1, 2, 3, 4, 5],
    };

    const command = new ExportToExcelCommand();
    command.context = { limetype: 'deal', id: null };
    command.filter = selectedRows;
    command.includeRelations = true;

    await commandBus.handle(command);
    import {
    Command,
    Expression,
    LimeObjectBulkCommand,
    LimeTypeContext,
    Operator,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    @Command({ id: 'update-deal-status' })
    class UpdateStatusCommand implements LimeObjectBulkCommand {
    public context: LimeTypeContext;
    public filter: Expression | null;
    public newStatus: string;
    }

    const commandBus = platform.get(PlatformServiceName.CommandBus);

    const command = new UpdateStatusCommand();

    // The parent narrows the command to deals that belong to company 123. Together
    // with the filter it selects the pending deals of that one company.
    command.context = {
    limetype: 'deal',
    id: null,
    parent: { limetype: 'company', id: 123 },
    };
    command.filter = { key: 'status', op: Operator.EQUALS, exp: 'pending' };
    command.newStatus = 'active';

    await commandBus.handle(command);
    interface LimeObjectBulkCommand {
        context: LimeTypeContext;
        filter: Expression | null;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    Properties

    Context describing the LimeType the command will operate on.

    Must include limetype to identify which type of objects to operate on. If parent is set on the context, it indicates that the LimeObjects are all related to a common parent LimeObject via a belongsto relation.

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

    const allDeals: LimeTypeContext = { limetype: 'deal', id: null };

    const dealsOfOneCompany: LimeTypeContext = {
    limetype: 'deal',
    id: null,
    parent: { limetype: 'company', id: 456 },
    };
    filter: Expression | null

    An Expression describing which LimeObjects to operate on.

    Can be null to operate on all objects (subject to parent context filtering), or a filter expression to limit the operation to specific records.

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

    const selectedIds: Expression = {
    key: 'id',
    op: Operator.IN,
    exp: [1, 2, 3],
    };

    const largeActiveDeals: Expression = {
    op: Operator.AND,
    exp: [
    { key: 'status', op: Operator.EQUALS, exp: 'active' },
    { key: 'value', op: Operator.GREATER, exp: 10_000 },
    ],
    };

    // null means every object the context allows, with no further filtering.
    const allObjects: Expression | null = null;