packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/closed-won-automations.mdx
When a deal closes, multiple things need to happen: update company status, notify team members, create onboarding tasks. Automate all of this with a single workflow.
When an opportunity moves to "Closed Won":
Doing this manually is time-consuming and error-prone.
Create a workflow that handles all post-win activities automatically.
{{trigger.object.stage}} equals "Closed Won"| Field | Value |
|---|---|
| Object | Companies |
| Record | {{trigger.object.company.id}} |
| Type | Customer |
| First Deal Date | {{trigger.object.closedAt}} |
| Account Owner | {{trigger.object.owner.id}} |
| Field | Value |
|---|---|
| Object | Tasks |
| Title | Onboarding: {{trigger.object.name}} |
| Assignee | Customer Success team member |
| Due Date | 3 days from now |
| Priority | High |
| Related Company | {{trigger.object.company.id}} |
| Related Opportunity | {{trigger.object.id}} |
| Description | New customer onboarding for {{trigger.object.company.name}}. Deal value: {{trigger.object.amount}} |
| Field | Value |
|---|---|
| To | [email protected] |
| Subject | 🎉 New Customer: {{trigger.object.company.name}} |
| Body | See example below |
Email body example:
Hi CS Team,
We have a new customer!
Company: {{trigger.object.company.name}}
Deal: {{trigger.object.name}}
Value: {{trigger.object.amount}}
Sales Rep: {{trigger.object.owner.name}}
Close Date: {{trigger.object.closedAt}}
An onboarding task has been created automatically.
Let's give them a great start!
| Field | Value |
|---|---|
| To | {{trigger.object.owner.email}} |
| Subject | ✅ Deal Closed: {{trigger.object.name}} |
| Body | Congratulations! Your deal has been processed. The customer success team has been notified and onboarding has begun. |
Create a similar workflow for lost deals:
For complex onboarding, create multiple tasks:
export const main = async (params) => {
const tasks = [
{ title: "Welcome call", daysFromNow: 1, assignee: "CS" },
{ title: "Send onboarding materials", daysFromNow: 2, assignee: "CS" },
{ title: "Technical setup", daysFromNow: 5, assignee: "Support" },
{ title: "30-day check-in", daysFromNow: 30, assignee: "CS" }
];
return { tasks };
};
Use Iterator to create each task from the array.
Use Filter actions to:
Use Code action to format: