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.

Example

@Command({ id: 'export-to-excel' })
export class ExportToExcelCommand implements LimeObjectBulkCommand {
public context: LimeWebComponentContext & { limetype: string };
public filter: Expression | null;
public includeRelations: boolean;

constructor(
context?: LimeWebComponentContext & { limetype: string },
filter?: Expression | null,
includeRelations: boolean = false
) {
this.context = context;
this.filter = filter;
this.includeRelations = includeRelations;
}
}

Example

// Execute a bulk command on selected items
const commandBus = platform.get(PlatformServiceName.CommandBus);

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

const command = new ExportToExcelCommand(
{ limetype: 'deal' },
selectedFilter,
true
);

await commandBus.handle(command);

Example

// Bulk command with parent context (related objects)
const command = new UpdateStatusCommand(
{
limetype: 'deal',
parent: { limetype: 'company', id: 123 }
},
{
key: 'status',
op: '=',
exp: 'pending'
},
'active' // New status value
);
// This will update all pending deals for company #123

Hierarchy

Implemented by

Properties

Properties

context: LimeWebComponentContext & {
    limetype: string;
}

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.

Example

// All deals (no parent filter)
context = { limetype: 'deal' }

// Only deals related to a specific company
context = { limetype: 'deal', parent: { limetype: 'company', id: 456 } }
filter: Expression

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.

Example

// Operate on selected IDs
filter = { key: 'id', op: 'IN', exp: [1, 2, 3] };

// Operate on objects matching criteria
filter = {
op: 'AND',
exp: [
{ key: 'status', op: '=', exp: 'active' },
{ key: 'value', op: '>', exp: 10000 }
]
};

// Operate on all objects
filter = null;