Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 3s
106 lines
2.9 KiB
Plaintext
106 lines
2.9 KiB
Plaintext
---
|
|
title: Send Email Alerts with Tasks Due
|
|
description: Automatically notify team members about their upcoming or overdue tasks.
|
|
---
|
|
import { VimeoEmbed } from '/snippets/vimeo-embed.mdx';
|
|
|
|
<img src="/images/user-guide/workflows/email_tasks_due.png" style={{width:'100%'}}/>
|
|
|
|
Send daily email reminders to each team member about their tasks due today.
|
|
|
|
## Overview
|
|
|
|
This workflow runs on a schedule and:
|
|
1. Fetches all workspace members
|
|
2. Loops through each member
|
|
3. Finds their tasks due today
|
|
4. Formats and sends a personalized email
|
|
|
|
## Step-by-Step Setup
|
|
|
|
<VimeoEmbed videoId="1147463514" title="Video demonstration" />
|
|
|
|
### Step 1: Configure the Trigger
|
|
|
|
1. Go to **Settings → Workflows** and create a new workflow
|
|
2. Select **On a Schedule** as the trigger
|
|
3. Use a cron expression for daily at 8:00 AM: `0 8 * * *`
|
|
|
|
|
|
### Step 2: Search for All Workspace Members
|
|
|
|
1. Add a **Search Records** action
|
|
2. Select **Workspace Members** (under advanced objects)
|
|
3. No filters needed — this returns all members
|
|
|
|
### Step 3: Add an Iterator
|
|
|
|
1. Add an **Iterator** action
|
|
2. Set the input array to the workspace members from the previous step
|
|
3. All actions inside the iterator will run once per member
|
|
|
|
### Step 4: Search for Tasks Due Today (Inside Iterator)
|
|
|
|
1. Inside the iterator, add a **Search Records** action
|
|
2. Select **Tasks** as the object
|
|
3. Add filters:
|
|
- **Assignee** = current workspace member (from the iterator)
|
|
- **Due Date** = today
|
|
|
|
### Step 5: Format Tasks into Email Body (Inside Iterator)
|
|
|
|
Add a **Code** action to format the tasks into a readable list with links:
|
|
|
|
```javascript
|
|
export const main = async (params: {
|
|
tasksDue?: Array<{ id: string; title: string }> | null | string;
|
|
}) => {
|
|
const tasksDue =
|
|
typeof params.tasksDue === "string"
|
|
? JSON.parse(params.tasksDue)
|
|
: params.tasksDue;
|
|
|
|
if (!Array.isArray(tasksDue) || tasksDue.length === 0) {
|
|
return {
|
|
formattedTasks: "No tasks due today."
|
|
};
|
|
}
|
|
|
|
const formattedTasks = tasksDue
|
|
.map(
|
|
t =>
|
|
`${t.title}\nhttps://yourSubDomain.twenty.com/object/task/${t.id}`
|
|
)
|
|
.join("\n\n");
|
|
|
|
return { formattedTasks };
|
|
};
|
|
```
|
|
|
|
<Note>
|
|
Replace `yourSubDomain` with your actual Twenty workspace subdomain.
|
|
</Note>
|
|
|
|
### Step 6: Send Email (Inside Iterator)
|
|
|
|
1. Add a **Send Email** action (still inside the iterator)
|
|
2. Configure:
|
|
|
|
| Field | Value |
|
|
|-------|-------|
|
|
| **To** | `{{iterator.currentItem.userEmail}}` (workspace member's email) |
|
|
| **Subject** | Your Tasks Due Today |
|
|
| **Body** | `{{code.formattedTasks}}` |
|
|
|
|
### Step 7: Test and Activate
|
|
|
|
1. Click **Test** to run the workflow manually
|
|
2. Check inboxes for the emails
|
|
3. Activate the workflow
|
|
|
|
## Related
|
|
|
|
- [Workflow Actions](/user-guide/workflows/capabilities/workflow-actions)
|
|
- [Send Emails from Workflows](/user-guide/workflows/capabilities/send-emails-from-workflows)
|
|
- [Handle Arrays in Code Actions](/user-guide/workflows/how-tos/advanced-configurations/handle-arrays-in-code-actions)
|