The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
docs: fix workflow trigger variable paths (#28072)
Thomas Trompette972fabb6bfec
diff --git a/packages/twenty-docs/user-guide/workflows/capabilities/send-emails-from-workflows.mdx b/packages/twenty-docs/user-guide/workflows/capabilities/send-emails-from-workflows.mdxindex be2868f6ba2..b41200a74c4 100644--- a/packages/twenty-docs/user-guide/workflows/capabilities/send-emails-from-workflows.mdx+++ b/packages/twenty-docs/user-guide/workflows/capabilities/send-emails-from-workflows.mdx@@ -30,9 +30,9 @@ Before you can send emails from workflows:| Field | Value ||-------|-------|-| **To** | `{{trigger.object.email}}` |+| **To** | `{{trigger.properties.after.emails.primaryEmail}}` || **Subject** | `Welcome to {{Your Company Name}}` |-| **Body** | `Hi {{trigger.object.firstName}}, ...` |+| **Body** | `Hi {{trigger.properties.after.name.firstName}}, ...` |4. **Test and activate**: Test with a sample record, then activate@@ -41,12 +41,10 @@ Before you can send emails from workflows:Reference data from previous steps using `{{variable}}` syntax:```text-Hi {{trigger.object.firstName}},+Hi {{trigger.properties.after.name.firstName}},Thank you for connecting with us!-Your company, {{trigger.object.company.name}}, is now in our system.-Best regards,The Team```@@ -55,9 +53,12 @@ The Team| Trigger Type | Common Variables ||--------------|------------------|-| **Record Created/Updated** | `{{trigger.object.fieldName}}` |-| **Manual** | `{{trigger.selectedRecord.fieldName}}` |-| **Webhook** | `{{trigger.body.fieldName}}` |+| **Record Created/Updated** | `{{trigger.properties.after.fieldName}}` |+| **Record Deleted** | `{{trigger.properties.before.fieldName}}` |+| **Manual** (on a selected record) | `{{trigger.payload.fieldName}}` |+| **Webhook** | `{{trigger.fieldName}}` |++Relation fields only expose the related record's ID, for example `{{trigger.properties.after.companyId}}`. To use other fields of the related record, add a **Search Records** step first. The easiest way to get the right path is to insert the variable from the picker.## Advanced: Conditional Emails@@ -70,7 +71,7 @@ The Team1. **Trigger**: Record is Created (People)2. **Add Filter action**:- - Condition: `{{trigger.object.source}}` equals `"Website"`+ - Condition: `{{trigger.properties.after.source}}` equals `"Website"`- If true → continue to website welcome email3. **Branch for other sources**:@@ -87,15 +88,19 @@ The Team1. **Trigger**: Record is Updated (Opportunities, Stage = "Closed Won")-2. **Search Records**: Find the opportunity owner's manager+2. **Search Records** (name it "Find Owner"): Find the opportunity owner+ - Object: Workspace Members+ - Filter: ID equals `{{trigger.properties.after.ownerId}}`++3. **Search Records**: Find the opportunity owner's manager-3. **Send Email #1**: To opportunity owner- - To: `{{trigger.object.owner.email}}`- - Subject: `Congratulations on closing {{trigger.object.name}}!`+4. **Send Email #1**: To opportunity owner+ - To: `{{Find Owner.first.userEmail}}` (select it from the variable picker; typing the step name does not work)+ - Subject: `Congratulations on closing {{trigger.properties.after.name}}!`-4. **Send Email #2**: To manager+5. **Send Email #2**: To manager- To: `{{searchRecords.manager.email}}`- - Subject: `Deal Won: {{trigger.object.name}}`+ - Subject: `Deal Won: {{trigger.properties.after.name}}`## Scheduled Follow-up Emailsdiff --git a/packages/twenty-docs/user-guide/workflows/capabilities/use-iterator.mdx b/packages/twenty-docs/user-guide/workflows/capabilities/use-iterator.mdxindex 1531bbb48dc..c7f80abe9a3 100644--- a/packages/twenty-docs/user-guide/workflows/capabilities/use-iterator.mdx+++ b/packages/twenty-docs/user-guide/workflows/capabilities/use-iterator.mdx@@ -107,12 +107,12 @@ In the variable picker, you can either drill into a specific field of the curren```1. Webhook Trigger (receives items array)2. Filter (items.length > 0)-3. Iterator (trigger.body.items)+3. Iterator (trigger.items)└── Create Record- Object: Order Items- Name: {{iterator.currentItem.name}}- Quantity: {{iterator.currentItem.qty}}- - Related Order: {{trigger.body.orderId}}+ - Related Order: {{trigger.orderId}}```### Conditional Processing Inside Loopdiff --git a/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdxindex c9e6b4cb311..42071d9eacf 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx@@ -41,7 +41,7 @@ With a Manual Trigger, users can run this workflow using a button that appears o| Parameter | Value ||-----------|-------|-| `companyId` | `{{trigger.object.id}}` |+| `companyId` | `{{trigger.payload.id}}` |<Note>If attaching to a different object (Person, Opportunity, etc.), rename the parameter accordingly (e.g., `personId`, `opportunityId`) and update the logic function.diff --git a/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-quote-or-invoice-from-twenty.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-quote-or-invoice-from-twenty.mdxindex daf8ac950e8..e497dbe2cf8 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-quote-or-invoice-from-twenty.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/generate-quote-or-invoice-from-twenty.mdx@@ -40,7 +40,7 @@ The Opportunity record may not include all Company fields you need for the invoi| Setting | Value ||---------|-------|| **Object** | Company |-| **Match by** | ID equals `{{trigger.object.companyId}}` |+| **Match by** | ID equals `{{trigger.properties.after.companyId}}` |This retrieves the full Company record with billing address, tax ID, etc.diff --git a/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/set-up-a-webhook-trigger.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/set-up-a-webhook-trigger.mdxindex 5746ea09dd2..ae91cadf546 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/set-up-a-webhook-trigger.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/connect-to-other-tools/set-up-a-webhook-trigger.mdx@@ -63,10 +63,10 @@ Now add actions that use the webhook data:| Field | Value ||-------|-------|-| First Name | `{{trigger.body.firstName}}` |-| Last Name | `{{trigger.body.lastName}}` |-| Email | `{{trigger.body.email}}` |-| Company | Search or create based on `{{trigger.body.company}}` |+| First Name | `{{trigger.firstName}}` |+| Last Name | `{{trigger.lastName}}` |+| Email | `{{trigger.email}}` |+| Company | Search or create based on `{{trigger.company}}` |### Step 5: Test the Webhook@@ -104,7 +104,7 @@ If your webhook sends nested data:}```-Reference with: `{{trigger.body.contact.email}}`+Reference with: `{{trigger.contact.email}}`### Arraysdiff --git a/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/auto-reply-to-inbound-emails.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/auto-reply-to-inbound-emails.mdxindex 85fb10784aa..8ed8aa920a9 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/auto-reply-to-inbound-emails.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/auto-reply-to-inbound-emails.mdx@@ -34,7 +34,7 @@ The sender's address isn't on the message itself — it's on the related Message| Field | Value ||-------|-------|| **Object** | Message Participants |-| **Filter** | Message **is** `{{trigger.id}}` |+| **Filter** | Message **is** `{{trigger.properties.after.id}}` || **Filter** | Role **is** From || **Limit** | 1 |@@ -52,8 +52,8 @@ Use a prompt like:You are an email triage assistant for a sales team. Read the followinginbound email and decide if it deserves a reply.-Subject: {{trigger.subject}}-Body: {{trigger.text}}+Subject: {{trigger.properties.after.subject}}+Body: {{trigger.properties.after.text}}From: {{Find Sender.first.displayName}} ({{Find Sender.first.handle}})If this email is spam, a newsletter, an automated notification, or@@ -92,9 +92,9 @@ Add a **Send Email** action on the "if true" branch. Click **Advanced options**,| Field | Value ||-------|-------|| **To** | `{{Find Sender.first.handle}}` |-| **Subject** | `Re: {{trigger.subject}}` |+| **Subject** | `Re: {{trigger.properties.after.subject}}` || **Body** | `{{AI Triage & Draft Reply.response}}` |-| **In-Reply-To** | `{{trigger.headerMessageId}}` |+| **In-Reply-To** | `{{trigger.properties.after.headerMessageId}}` |The In-Reply-To field is what makes this a reply instead of a new conversation. The recipient sees it threaded under the original email in Gmail, Outlook, or any other client.diff --git a/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/closed-won-automations.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/closed-won-automations.mdxindex 80572e344cb..0130735f7f9 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/closed-won-automations.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/closed-won-automations.mdx@@ -36,7 +36,7 @@ Create a workflow that handles all post-win activities automatically.### Step 3: Add Stage Filter1. Add **Filter** action-2. Condition: `{{trigger.object.stage}}` equals "Closed Won"+2. Condition: `{{trigger.properties.after.stage}}` equals "Closed Won"### Step 4: Update Company Type@@ -46,10 +46,12 @@ Create a workflow that handles all post-win activities automatically.| Field | Value ||-------|-------|| **Object** | Companies |-| **Record** | `{{trigger.object.company.id}}` |+| **Record** | `{{trigger.properties.after.companyId}}` || **Type** | Customer |-| **First Deal Date** | `{{trigger.object.closedAt}}` |-| **Account Owner** | `{{trigger.object.owner.id}}` |+| **First Deal Date** | `{{trigger.properties.after.closeDate}}` |+| **Account Owner** | `{{trigger.properties.after.ownerId}}` |++Name this step "Update Company". Its output is the updated company, so later steps can insert its fields from the variable picker, shown below as `{{Update Company.name}}`. Pick them from the picker rather than typing them: variables point to the step's ID, not its name.### Step 5: Create Onboarding Task@@ -59,13 +61,13 @@ Create a workflow that handles all post-win activities automatically.| Field | Value ||-------|-------|| **Object** | Tasks |-| **Title** | `Onboarding: {{trigger.object.name}}` |+| **Title** | `Onboarding: {{trigger.properties.after.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}}` |+| **Related Company** | `{{trigger.properties.after.companyId}}` |+| **Related Opportunity** | `{{trigger.properties.after.id}}` |+| **Description** | `New customer onboarding for {{Update Company.name}}.` |### Step 6: Notify Customer Success@@ -75,7 +77,7 @@ Create a workflow that handles all post-win activities automatically.| Field | Value ||-------|-------|| **To** | [email protected] |-| **Subject** | `🎉 New Customer: {{trigger.object.company.name}}` |+| **Subject** | `🎉 New Customer: {{Update Company.name}}` || **Body** | See example below |**Email body example**:@@ -84,11 +86,9 @@ 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}}+Company: {{Update Company.name}}+Deal: {{trigger.properties.after.name}}+Close Date: {{trigger.properties.after.closeDate}}An onboarding task has been created automatically.@@ -97,15 +97,24 @@ Let's give them a great start!### Step 7: Confirm to Sales Rep-1. Add another **Send Email** action-2. Configure:+1. Add a **Search Records** action named "Find Owner" to get the sales rep:| Field | Value ||-------|-------|-| **To** | `{{trigger.object.owner.email}}` |-| **Subject** | `✅ Deal Closed: {{trigger.object.name}}` |+| **Object** | Workspace Members |+| **Filter** | ID equals `{{trigger.properties.after.ownerId}}` |++2. Add another **Send Email** action+3. Configure:++| Field | Value |+|-------|-------|+| **To** | `{{Find Owner.first.userEmail}}` |+| **Subject** | `✅ Deal Closed: {{trigger.properties.after.name}}` || **Body** | Congratulations! Your deal has been processed. The customer success team has been notified and onboarding has begun. |+Select the **To** value from the variable picker under the "Find Owner" step.+### Step 8: Test and Activate1. Test by moving a test opportunity to "Closed Won"diff --git a/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/display-related-record-data.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/display-related-record-data.mdxindex 7283c70fdcd..2b109d07422 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/display-related-record-data.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/crm-automations/display-related-record-data.mdx@@ -33,11 +33,11 @@ Create the destination fields in **Settings → Data Model → Opportunities** b3. **Search Records**: Find the linked person- Object: People- - Filter: ID equals `{{trigger.object.pointOfContact.id}}`+ - Filter: ID equals `{{trigger.properties.after.pointOfContactId}}`4. **Update Record**:- Object: Opportunities- - Record: `{{trigger.object.id}}`+ - Record: `{{trigger.properties.after.id}}`- Contact Email: `{{searchRecords[0].email}}`- Contact Phone: `{{searchRecords[0].phone}}`@@ -54,16 +54,16 @@ Create the destination fields in **Settings → Data Model → Opportunities** b2. **Search Records**: Find all opportunities for this company- Object: Opportunities- - Filter: Company ID equals `{{trigger.object.id}}`+ - Filter: Company ID equals `{{trigger.properties.after.id}}`3. **Iterator**: Loop through each opportunity4. **Update Record** (inside iterator):- Object: Opportunities- Record: `{{iterator.currentItem.id}}`- - Company Industry: `{{trigger.object.industry}}`- - Company Size: `{{trigger.object.companySize}}`- - Company ARR: `{{trigger.object.annualRevenue}}`+ - Company Industry: `{{trigger.properties.after.industry}}`+ - Company Size: `{{trigger.properties.after.companySize}}`+ - Company ARR: `{{trigger.properties.after.annualRevenue}}`## Copy on Record Creation@@ -84,11 +84,11 @@ Create the destination fields in **Settings → Data Model → Opportunities**:2. **Search Records**: Get the linked company's details- Object: Companies- - Filter: ID equals `{{trigger.object.company.id}}`+ - Filter: ID equals `{{trigger.properties.after.companyId}}`3. **Update Record**:- Object: Opportunities- - Record: `{{trigger.object.id}}`+ - Record: `{{trigger.properties.after.id}}`- Company Industry: `{{searchRecords[0].industry}}`- Company Size: `{{searchRecords[0].employees}}`diff --git a/packages/twenty-docs/user-guide/workflows/how-tos/need-more-help/workflows-faq.mdx b/packages/twenty-docs/user-guide/workflows/how-tos/need-more-help/workflows-faq.mdxindex f6c95e37fab..15c38573803 100644--- a/packages/twenty-docs/user-guide/workflows/how-tos/need-more-help/workflows-faq.mdx+++ b/packages/twenty-docs/user-guide/workflows/how-tos/need-more-help/workflows-faq.mdx@@ -91,7 +91,7 @@ description: Frequently asked questions about workflows in Twenty.- Or type `{{stepName.fieldName}}` directly**Examples**:- - Trigger data: `{{trigger.object.email}}`+ - Trigger data: `{{trigger.properties.after.name}}` for a record trigger, `{{trigger.payload.name}}` for a manual trigger on a selected record- Search results: `{{searchRecords[0].name}}`- Code output: `{{code.calculatedValue}}`