feat(automations): form-driven branching rules, round-robin assignment, lead-linked activities

This commit is contained in:
2026-10-11 14:12:36 +03:30
parent b30f68563d
commit b3b92abae9
27 changed files with 1160 additions and 91 deletions
+13 -1
View File
@@ -385,7 +385,19 @@ export class LeadFormsService {
personId,
ownerId: ownerId ?? actorId,
};
await this.automations.runTrigger('lead_submitted', leadCtx);
await this.automations.runTrigger('lead_submitted', {
...leadCtx,
entityType: personId ? 'person' : leadId ? 'lead' : 'person',
sourceId: form.id,
sourceType: 'lead_form',
leadId,
mobile: mapped.mobile ?? mapped.phone ?? null,
formName: form.name,
formValues: values,
formFields: form.fields
.filter((f) => f.fieldType !== 'heading')
.map((f) => ({ key: f.key, label: f.label })),
});
await this.messageAutomations.onEvent('lead_submitted', leadCtx);
return {