Let automations fire on more CRM events and open the studio from the main nav.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-09 21:43:17 +03:30
co-authored by Cursor
parent 51684daa61
commit f1aba1b386
20 changed files with 419 additions and 49 deletions
+22 -4
View File
@@ -147,6 +147,17 @@ export class DealsService {
include: dealInclude,
});
await this.automations.runTrigger('deal_created', {
organizationId,
entityType: 'deal',
entityId: created.id,
title: created.title,
personId: created.personId,
companyId: created.companyId,
dealId: created.id,
ownerId: created.ownerId,
});
return this.pipelines.toDealDto(created);
}
@@ -290,17 +301,24 @@ export class DealsService {
});
}
if (status === 'won' && deal.status !== 'won') {
await this.automations.runTrigger('deal_won', {
if (deal.stageId !== stage.id) {
const ctx = {
organizationId,
entityType: 'deal',
entityType: 'deal' as const,
entityId: deal.id,
title: deal.title,
personId: deal.personId,
companyId: deal.companyId,
dealId: deal.id,
ownerId: deal.ownerId,
});
};
await this.automations.runTrigger('deal_stage_changed', ctx);
if (status === 'won' && deal.status !== 'won') {
await this.automations.runTrigger('deal_won', ctx);
}
if (status === 'lost' && deal.status !== 'lost') {
await this.automations.runTrigger('deal_lost', ctx);
}
}
return this.pipelines.toDealDto(row);