mirror of
https://github.com/wekan/wekan.git
synced 2026-11-26 01:49:41 -05:00
Docs: Rules: what each feature is, how to use it, how its numbers are calculated, how it works, and its commits.
Corrected from the code: a rule may have up to ten more triggers and ten more actions (it said one of each); rule suggestions count the different cards a pair happened on, not the times; Blocks and History are opened from Board Settings, the Rules page's own sidebar being gone; the Rules page has a Back to the board; the rule variables list the short, people and custom field tokens too; the IFTTT screenshots load from this folder instead of the wekan.fi addresses that no longer answer. Thanks to xet7 !
This commit is contained in:
1 parent
33a3e2f8a3
commit
174debbeea
6 files changed
+568
-170
No files matched your search
@@ -1,5 +1,7 @@
|
||||
# Bots
|
||||
|
||||
## What it is
|
||||
|
||||
Board Settings → **Bots**, below **Workflow view**, is the [Rules](Rules/Rules.md)
|
||||
page's view for **bots**: runners on your own server that this board hands
|
||||
cards to. A runner can be an AI coding agent, a CI job or a script. The view
|
||||
@@ -8,6 +10,34 @@ drag and drop. Like the rest of the Rules page it is for **board admins only**.
|
||||
It is not a board view: it is not in the Board View menu and can never be a
|
||||
public view.
|
||||
|
||||
## Read more
|
||||
|
||||
- [Software agent](https://en.wikipedia.org/wiki/Software_agent) and
|
||||
[Continuous integration](https://en.wikipedia.org/wiki/Continuous_integration)
|
||||
on Wikipedia - the kinds of runner a board hands cards to.
|
||||
- [Webhook](https://en.wikipedia.org/wiki/Webhook) - how WeKan tells the runner
|
||||
about a card, and
|
||||
[REST](https://en.wikipedia.org/wiki/Representational_state_transfer) - how
|
||||
the runner works on the board.
|
||||
- [Server-side request forgery](https://en.wikipedia.org/wiki/Server-side_request_forgery)
|
||||
- what the webhook queue's SSRF guard prevents.
|
||||
- In WeKan: [Rules (Automation)](Rules/Rules.md),
|
||||
[outgoing requests through a proxy](../Board-Sidebar/Board-Settings/Outgoing-Webhooks/Proxy.md),
|
||||
[webhook data](../Board-Sidebar/Board-Settings/Outgoing-Webhooks/Webhook-data.md).
|
||||
|
||||
## How to use it
|
||||
|
||||
1. Open the board's right sidebar → **Board Settings** → **Bots** (below
|
||||
**Workflow view**). You must be a board admin.
|
||||
2. In the rail, click **Add bot** and fill in **Bot name**, **Runner address**
|
||||
and, optionally, **Signing token (optional)**.
|
||||
3. Open a card from the columns. In the drawer, pick the bot and click **Hand
|
||||
to bot**. Or make a Rule with the action **Hand the card to bot**.
|
||||
4. Follow the run in the card's state, in **Live runs** and in **Activity**.
|
||||
When the bot asks a question, click one of the answers on the card, or type
|
||||
in **Reply to the bot** and click **Send**.
|
||||
5. Click **Stop** to stop a run.
|
||||
|
||||
```
|
||||
┌ Bots ───────────┬ Dev / Bots 2 running · 1 waiting for you ─┬ Fix login ─────┐
|
||||
│ ⚙ Coder host │ TODO 3 │ IN PROGRESS 2 │ REVIEW 1 │ DONE │ [Coder ▾][▶ Hand]│
|
||||
@@ -32,7 +62,26 @@ public view.
|
||||
order. **Hand to bot** gives the card to a bot, **Stop** stops the run, and
|
||||
the reply box answers the bot.
|
||||
|
||||
## A bot has no rights of its own
|
||||
## How the numbers are calculated
|
||||
|
||||
- The header line **N running · M waiting for you** (`bots-summary`) counts
|
||||
this board's runs whose status is `running`, and those whose status is
|
||||
`awaiting_input` (`runningCount`, `waitingCount` in
|
||||
[client/components/rules/rulesBots.js](../../../client/components/rules/rulesBots.js)).
|
||||
- A run keeps its **last 50 events** (`MAX_EVENTS`); a text is cut at 4,000
|
||||
characters (`MAX_TEXT`), a tool name and an option at 200, a question at
|
||||
1,000, and at most 8 answer options are kept (`MAX_OPTIONS`), all in
|
||||
[models/lib/botRuns.js](../../../models/lib/botRuns.js).
|
||||
- `tokens` and `costUsd` must be finite numbers from 0 to 10^12; they are
|
||||
shown as reported (e.g. `$0.12`), not computed by WeKan.
|
||||
- A dispatch carries at most the card's **last 20 comments**; a reply is cut
|
||||
at 65,536 characters ([server/bots.js](../../../server/bots.js)).
|
||||
- The Bots view is sent at most the **300 most recently updated runs** of the
|
||||
board (`botRuns` publication).
|
||||
|
||||
## How it works in WeKan
|
||||
|
||||
### A bot has no rights of its own
|
||||
|
||||
Bots are like Rules and workflows: they act only through what WeKan already
|
||||
allows, and override no WeKan permission.
|
||||
@@ -52,7 +101,7 @@ allows, and override no WeKan permission.
|
||||
- **Answers and replies** are the admin's own card comments, written under
|
||||
their right to comment in that list, and the bot is told.
|
||||
|
||||
## The runner's side
|
||||
### The runner's side
|
||||
|
||||
The dispatch is a JSON `POST` to the runner's address:
|
||||
|
||||
@@ -80,7 +129,7 @@ The runner reports at `report` with its own API token
|
||||
finished, the last 50 events are kept, and texts are bounded. Later the runner
|
||||
receives `bot.answer` (`value`, `text`), `bot.reply` (`text`) and `bot.stop`.
|
||||
|
||||
## Files
|
||||
### Files
|
||||
|
||||
| File | |
|
||||
| --- | --- |
|
||||
@@ -89,3 +138,14 @@ receives `bot.answer` (`value`, `text`), `bot.reply` (`text`) and `bot.stop`.
|
||||
| `models/lib/botRuns.js` | A run's states and what may change them. No Meteor code |
|
||||
| `models/botRuns.js` | The runs, written by the server only, published to board admins |
|
||||
| `tests/botRuns.test.cjs`, `server/lib/tests/bots.tests.js` | The tests |
|
||||
|
||||
A card already with a bot keeps its active run: handing it over again returns
|
||||
the same run (`dispatchToBot`). Handing over, answering, replying, stopping and
|
||||
the `botRuns` publication all check that the caller is a board admin
|
||||
(`allowIsBoardAdmin`); an answer or reply is also checked with
|
||||
`canCommentInList`.
|
||||
|
||||
## Commits
|
||||
|
||||
- [Board Settings / Bots: hand cards to external runners, as kanbots does](https://github.com/wekan/wekan/commit/aa48a2b71dea95842cba4daa908e6e236aaef1dd)
|
||||
- [File the Bots page under Rules, the way the WeKan menus are](https://github.com/wekan/wekan/commit/b7589737f5730ce1ba83244946e158519528a783)
|
||||
@@ -1,14 +1,76 @@
|
||||
# IFTTT / Rules (Automation)
|
||||
|
||||
## What it is
|
||||
|
||||
WeKan **Rules** ("if this then that") automate your board: when something happens
|
||||
(a **trigger**), WeKan runs an **action**.
|
||||
|
||||
> See the full, up-to-date reference at **[Features / Rules](../Rules/Rules.md)** —
|
||||
> this page is a quick overview. The Rules page is now a **fullscreen page** (board
|
||||
> sidebar → Rules), not a popup, and adds selecting, editing, import/export, a visual
|
||||
> sidebar → Board Settings → Rules), not a popup, and adds selecting, editing, import/export, a visual
|
||||
> **Workflow view**, scheduled rules, and a REST API.
|
||||
|
||||
## What's new beyond the basics below
|
||||
This page is the original IFTTT rules design and overview, from 2018; the
|
||||
current reference is [Rules (Automation)](../Rules/Rules.md).
|
||||
|
||||
## Read more
|
||||
|
||||
- [IFTTT](https://en.wikipedia.org/wiki/IFTTT) on Wikipedia - the "if this then
|
||||
that" service the feature is named after.
|
||||
- [Event condition action](https://en.wikipedia.org/wiki/Event_condition_action)
|
||||
- the trigger-then-action model.
|
||||
- In WeKan: [Rules (Automation)](../Rules/Rules.md),
|
||||
[Blocks view](../Rules/Blocks.md), [Rule suggestions](../Rule-Suggestions.md).
|
||||
|
||||
## How to use it
|
||||
|
||||
The screenshots below are from the first version, when Rules was a dialog. Today
|
||||
open the board's right sidebar → **Board Settings** → **Rules**.
|
||||
|
||||
### 1) Click: Menu item for the rules
|
||||
|
||||
<img src="main_menu-ifttt.png" alt="Navigation menu for the rule dialog" />
|
||||
|
||||
|
||||
### 2) Rule Menu: Overview, deleting and adding new rules
|
||||
<img src="ifttt_main_dialog.PNG" alt="Dialog Overview for the rules" />
|
||||
|
||||
|
||||
### 2a) Add new rule : Triggers
|
||||
Currently, there are three types of triggers: board, card and checklist
|
||||
|
||||
| Board | Card | Checklist |
|
||||
| ------------- | ------------- | ------------- |
|
||||
| create card | added/removed label, attachment, person | checklist added/removed |
|
||||
| card moved to | | check item checked/unchecked |
|
||||
| card moved from | | checklist completed |
|
||||
|
||||
|
||||
### 2b) Add new rule : Actions
|
||||
For every trigger, there are 4 types of actions: board, card, checklist and mail
|
||||
|
||||
| Board | Card | Checklist | Mail |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| move card to list | add/remove label, attachment, person | checklist add/remove | send email to |
|
||||
| move to top/bottom | set title/description | check/uncheck item | |
|
||||
| archive/unarchive | | checklist complete | |
|
||||
|
||||
### Example: how the rules work
|
||||
* Rule 1: When a card is added to the board -> Add label yellow
|
||||
* Rule 2: When a card is moved to List 2 -> Add checklist ToDo
|
||||
* Rule 3: When a card is added to List 1 -> Add label blue
|
||||
|
||||
<img src="how_to_work_with_rules.gif" alt="gif animation for rules" />
|
||||
|
||||
## How the numbers are calculated
|
||||
|
||||
The overview has no numbers of its own. The scheduled triggers' timing (checked
|
||||
every minute), the card-aging days and the rule e-mail limits are explained in
|
||||
[Rules (Automation)](../Rules/Rules.md#how-the-numbers-are-calculated).
|
||||
|
||||
## How it works in WeKan
|
||||
|
||||
### What's new beyond the basics above
|
||||
|
||||
- **Scheduled triggers:** run rules on a schedule (once / daily / weekday / weekly /
|
||||
monthly at a time), on **due dates** (set / approaching / overdue), or by **card
|
||||
@@ -25,43 +87,7 @@ WeKan **Rules** ("if this then that") automate your board: when something happen
|
||||
`automationRules`.
|
||||
- **REST API** to add/edit/remove rules — see [Rules REST API](#rules-rest-api) below.
|
||||
|
||||
## 1) Click: Menu item for the rules
|
||||
|
||||
<img src="https://wekan.fi/ifttt/main_menu-ifttt.png" alt="Navigation menu for the rule dialog" />
|
||||
|
||||
|
||||
## 2) Rule Menu: Overview, deleting and adding new rules
|
||||
<img src="https://wekan.fi/ifttt/ifttt_main_dialog.PNG" alt="Dialog Overview for the rules" />
|
||||
|
||||
|
||||
## 2a) Add new rule : Triggers
|
||||
Currently, there are three types of triggers: board, card and checklist
|
||||
|
||||
| Board | Card | Checklist |
|
||||
| ------------- | ------------- | ------------- |
|
||||
| create card | added/removed label, attachment, person | checklist added/removed |
|
||||
| card moved to | | check item checked/unchecked |
|
||||
| card moved from | | checklist completed |
|
||||
|
||||
|
||||
## 2b) Add new rule : Actions
|
||||
For every trigger, there are 4 types of actions: board, card, checklist and mail
|
||||
|
||||
| Board | Card | Checklist | Mail |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| move card to list | add/remove label, attachment, person | checklist add/remove | send email to |
|
||||
| move to top/bottom | set title/description | check/uncheck item | |
|
||||
| archive/unarchive | | checklist complete | |
|
||||
|
||||
|
||||
# Example : How the rule works
|
||||
* Rule 1: When a card is added to the board -> Add label yellow
|
||||
* Rule 2: When a card is moved to List 2 -> Add checklist ToDo
|
||||
* Rule 3: When a card is added to List 1 -> Add label blue
|
||||
|
||||
<img src="https://wekan.fi/ifttt/how_to_work_with_rules.gif" alt="gif animation for rules" />
|
||||
|
||||
# Rules REST API
|
||||
### Rules REST API
|
||||
|
||||
Rules can be added, edited and removed over the REST API. The trigger and action
|
||||
are embedded inline so each rule is self-contained.
|
||||
@@ -99,3 +125,15 @@ python3 api.py removerule BOARDID RULEID
|
||||
See [Features / Rules](../Rules/Rules.md) for the full list of trigger
|
||||
`activityType`s and action `actionType`s, scheduled rules, buttons, the visual
|
||||
Workflow view, and Trello/Jira import.
|
||||
|
||||
## Commits
|
||||
|
||||
- [Rules can be shown to board members, read-only](https://github.com/wekan/wekan/commit/f4a3690256c71909860a830cb8e4557f4a2c4348)
|
||||
- [Rules card title filter and the rules REST API](https://github.com/wekan/wekan/commit/25d33cec367b867ea9970e9ad27f723b36135c45)
|
||||
- [Scheduled rules, the Workflow view, buttons and rules import/export](https://github.com/wekan/wekan/commit/f0bce67a3bf301c21ded3eb97e84a3be0010290f)
|
||||
- [Export and import of rules](https://github.com/wekan/wekan/commit/8cb132f492d3e4eb41b9f6766a59312942e345fa)
|
||||
- [Finished alpha rules](https://github.com/wekan/wekan/commit/30a3daa6af179009ac17b40a71bf3f9e9b1d698a)
|
||||
- [Completed rules](https://github.com/wekan/wekan/commit/1f5f429fc4535d251d32335eea7e44904a924650)
|
||||
- [Main flow of triggers and actions implemented](https://github.com/wekan/wekan/commit/6828ccd7f17d14f178e6742d78bdd14428ec6e07)
|
||||
- [Triggers view](https://github.com/wekan/wekan/commit/93cc7f0232ee456aff07e456b9c4601264f47ab4)
|
||||
- [UI for the rules list](https://github.com/wekan/wekan/commit/f63482b58775a2f52fdd5f932ce7d14f16757133)
|
||||
@@ -1,11 +1,29 @@
|
||||
# Rules
|
||||
|
||||
Board automation, opened from the board hamburger menu → **Rules**
|
||||
(`client/components/rules/rulesMain.jade`). A rule is a trigger and an action;
|
||||
rules run on the server (`server/rulesHelper.js`) for the board they belong to.
|
||||
## What it is
|
||||
|
||||
Board automation, opened from the board's right sidebar → **Board Settings** →
|
||||
**Rules** (`client/components/rules/rulesMain.jade`). A rule is a trigger and an
|
||||
action; rules run on the server (`server/rulesHelper.js`) for the board they
|
||||
belong to.
|
||||
|
||||
## How to use it
|
||||
|
||||
Open a board's right sidebar, click **Board Settings**, then **Rules** or one
|
||||
of the Rules page's views right below it (**List view**, **Workflow view**,
|
||||
**Bots**, **Blocks**, **History**, **Import / Export rules**). Board admins
|
||||
change rules; a member reads them where the board shows its Rules. The pages:
|
||||
|
||||
- [Rules (Automation)](Rules/Rules.md) — triggers, actions and the rule list
|
||||
- [Blocks view](Rules/Blocks.md) — building a rule from blocks (`client/components/rules/rulesBlocks.jade`)
|
||||
- [IFTTT](IFTTT/IFTTT.md) — the original IFTTT rules design
|
||||
- [Rule suggestions](Rule-Suggestions.md) — rules offered from what people keep doing by hand
|
||||
- [Bots](Bots.md) — rules that act as a named bot (`client/components/rules/rulesBots.jade`)
|
||||
- [Bots](Bots.md) — external runners the board hands cards to (`client/components/rules/rulesBots.jade`)
|
||||
|
||||
See the pages above.
|
||||
|
||||
## Commits
|
||||
|
||||
- [Rule suggestions from what people on a board keep doing by hand](https://github.com/wekan/wekan/commit/2211b2411931b84ef0ec71c197e5630f71bff3c6)
|
||||
- [Board Settings / Bots: hand cards to external runners](https://github.com/wekan/wekan/commit/aa48a2b71dea95842cba4daa908e6e236aaef1dd)
|
||||
- [File the Rules pages the way the WeKan menus are](https://github.com/wekan/wekan/commit/b7589737f5730ce1ba83244946e158519528a783)
|
||||
@@ -1,17 +1,44 @@
|
||||
# Rule suggestions
|
||||
|
||||
Board hamburger menu → **Rules** shows, above the rule list, **Suggested rules**:
|
||||
## What it is
|
||||
|
||||
Board Settings → **Rules** shows, above the rule list, **Suggested rules**:
|
||||
things people on this board keep doing by hand that a rule could do for them.
|
||||
It is a count of what really happened on the board, not artificial
|
||||
intelligence: the same activities always give the same suggestions. Trello's
|
||||
Butler calls these automation suggestions.
|
||||
|
||||
> When a card is moved to **Done**, archive it - you did this 7 times in the last
|
||||
> 30 days. **Create rule**
|
||||
> When a card is moved to **Done**, archive it - Done by hand on 7 cards in
|
||||
> the last 30 days. **Create rule**
|
||||
|
||||
## How a suggestion is found
|
||||
## Read more
|
||||
|
||||
- [Event condition action](https://en.wikipedia.org/wiki/Event_condition_action)
|
||||
on Wikipedia - the trigger-and-action shape every suggested rule has.
|
||||
- [Association rule learning](https://en.wikipedia.org/wiki/Association_rule_learning)
|
||||
- the general idea of finding "after this, that" pairs by counting; WeKan's
|
||||
is a plain count, not a learning algorithm.
|
||||
- [Trello Butler](https://trello.com/butler) - the automation in Trello these
|
||||
follow.
|
||||
- In WeKan: [Rules (Automation)](Rules/Rules.md),
|
||||
[Admin Panel / Settings / Features](../Admin-Panel/Settings/Features.md).
|
||||
|
||||
## How to use it
|
||||
|
||||
1. Open the board's right sidebar → **Board Settings** → **Rules** (or **List
|
||||
view**). You must be a board admin.
|
||||
2. Above the rule list, read **Suggested rules**. Each line says what the rule
|
||||
would do and *Done by hand on N cards in the last 30 days*.
|
||||
3. Click **Create rule** to make it, or **Dismiss** to hide that suggestion.
|
||||
4. The new rule is in the rule list like any rule you built by hand; edit or
|
||||
delete it there.
|
||||
|
||||
### How a suggestion is found
|
||||
|
||||
From the board's activities of the last 30 days: when the same person does one
|
||||
thing to a card and then, within two minutes, another thing to the same card,
|
||||
that pair is counted. A pair counted three times or more becomes a suggestion,
|
||||
most frequent first, at most five.
|
||||
that pair is counted for that card. A pair seen on three cards or more becomes
|
||||
a suggestion, most cards first, at most five.
|
||||
|
||||
| First thing (the trigger) | Second thing (the action) |
|
||||
| --- | --- |
|
||||
@@ -26,14 +53,51 @@ suggestion for you on this board.
|
||||
|
||||
Only board admins see the section, because only they may create rules.
|
||||
|
||||
## Hiding it
|
||||
### Hiding it
|
||||
|
||||
Admin Panel / Settings / Features: **Rule suggestions**. Rules
|
||||
themselves are not affected.
|
||||
|
||||
## Implementation
|
||||
## How the numbers are calculated
|
||||
|
||||
`models/lib/ruleSuggestions.js` (pure: pairs from activities, counting,
|
||||
filtering out existing rules), method `rules.suggestions` in
|
||||
`server/methods/ruleSuggestions.js`, drawn by `rulesMain` in
|
||||
`client/components/rules/rulesMain.jade`. Tests: `tests/ruleSuggestions.test.cjs`.
|
||||
All in [models/lib/ruleSuggestions.js](../../../models/lib/ruleSuggestions.js):
|
||||
|
||||
- **30 days** (`DAYS`): only activities with `createdAt` in the last
|
||||
30 × 24 × 60 × 60 × 1000 ms are read, newest first, at most 20,000
|
||||
(`MAX_ACTIVITIES` in
|
||||
[server/methods/ruleSuggestions.js](../../../server/methods/ruleSuggestions.js)).
|
||||
- **Two minutes** (`WINDOW_MS` = 2 × 60 × 1000 ms): the activities are grouped
|
||||
by card and person and sorted by time; every trigger activity is paired with
|
||||
each later allowed action of the same card and person no more than two
|
||||
minutes after it.
|
||||
- **The count** shown is the number of **different cards** the pair happened
|
||||
on (`cards.size`), not the number of times: doing it twice on one card counts
|
||||
once.
|
||||
- **Three cards** (`MIN_CARDS`) is the threshold, and **five** (`LIMIT`) the
|
||||
most suggestions shown, sorted by the count, then by the pair's key.
|
||||
- A pair whose list, label or member no longer exists (an archived list, a
|
||||
label removed, an inactive member) is not suggested.
|
||||
|
||||
## How it works in WeKan
|
||||
|
||||
- `models/lib/ruleSuggestions.js` (pure: pairs from activities, counting,
|
||||
filtering out existing rules, `isSuggestionKey`).
|
||||
- Methods `rules.suggestions` and `rules.dismissSuggestion` in
|
||||
`server/methods/ruleSuggestions.js`: they answer only a board admin, and only
|
||||
while the feature is on for that user (`featureOnFor(userId,
|
||||
'rule-suggestions')`); `rules.suggestions` is rate-limited to 10 calls and
|
||||
`rules.dismissSuggestion` to 20 calls per 10 seconds per connection. A
|
||||
dismissed suggestion's key is stored in your
|
||||
`profile.dismissedRuleSuggestions.<boardId>`.
|
||||
- **Create rule** goes through `rules.createRule`, unchanged.
|
||||
- Drawn by `ruleSuggestions` in
|
||||
[client/components/rules/ruleSuggestions.jade](../../../client/components/rules/ruleSuggestions.jade),
|
||||
placed by `rulesMain` in
|
||||
[client/components/rules/rulesMain.jade](../../../client/components/rules/rulesMain.jade)
|
||||
above `rulesList`, so it shows only in the list view.
|
||||
- Tests: [tests/ruleSuggestions.test.cjs](../../../tests/ruleSuggestions.test.cjs)
|
||||
and [tests/rulesWorkflowViewToggle.test.cjs](../../../tests/rulesWorkflowViewToggle.test.cjs).
|
||||
|
||||
## Commits
|
||||
|
||||
- [Rule suggestions from what people on a board keep doing by hand](https://github.com/wekan/wekan/commit/2211b2411931b84ef0ec71c197e5630f71bff3c6)
|
||||
@@ -1,6 +1,76 @@
|
||||
# Blocks view for IFTTT Rules
|
||||
|
||||
## Implementation plan
|
||||
## What it is
|
||||
|
||||
**Blocks** is a view of the board's Rules page in which a rule is built by
|
||||
dragging a trigger block and an action block together, Scratch style, with
|
||||
[Blockly](https://github.com/RaspberryPiFoundation/blockly). It edits the same
|
||||
rules as the List and Workflow views, as one trigger followed by one action. It
|
||||
is for board administrators, and it never runs generated code.
|
||||
|
||||
## Read more
|
||||
|
||||
- [Visual programming language](https://en.wikipedia.org/wiki/Visual_programming_language)
|
||||
and [Scratch](https://en.wikipedia.org/wiki/Scratch_(programming_language))
|
||||
on Wikipedia - the block-editing idea.
|
||||
- [Blockly](https://developers.google.com/blockly), the library the view uses.
|
||||
- [Event condition action](https://en.wikipedia.org/wiki/Event_condition_action)
|
||||
- the trigger-then-action model of a rule.
|
||||
- In WeKan: [Rules (Automation)](Rules.md), [IFTTT](../IFTTT/IFTTT.md),
|
||||
[History](../../General/History/History.md).
|
||||
|
||||
### Dependency references
|
||||
|
||||
- [Blockly source and Apache-2.0 license](https://github.com/RaspberryPiFoundation/blockly)
|
||||
- [Package installation](https://docs.blockly.com/guides/get-started/get-the-code/)
|
||||
- [JSON workspace serialization](https://developers.google.com/blockly/guides/configure/web/serialization)
|
||||
|
||||
## How to use it
|
||||
|
||||
1. Open the board's right sidebar → **Board Settings** → **Blocks** (below
|
||||
**Rules**). You must be a board admin.
|
||||
2. Choose an existing rule in the rule picker, or click **Add rule** and type
|
||||
the **New rule title**.
|
||||
3. Drag a trigger and an action from the toolbox into the workspace and
|
||||
connect them: *Connect one trigger to one action.*
|
||||
4. Edit the blocks' fields. For advanced options use **Edit trigger/action**,
|
||||
the form editor.
|
||||
5. Click **Save**. The page says **Rule saved**, or **Unsaved changes** while
|
||||
there are edits; **Reload saved rule** throws a draft away.
|
||||
|
||||
### Using Blocks
|
||||
|
||||
Open the board's right sidebar → **Board Settings** and select **Blocks**
|
||||
below **Rules** (the Rules page's own sidebar is gone; its views are listed
|
||||
there). Board Settings also provides direct List view, Workflow view and
|
||||
History choices. Board administrators can
|
||||
select an existing rule or create a new one, drag a trigger and action into the
|
||||
workspace, connect them, edit their supported fields and save. Use **Edit trigger
|
||||
and action** for advanced settings in the existing form editor. A workspace must
|
||||
contain exactly one connected trigger/action pair to save. Unknown stored
|
||||
parameters are retained rather than discarded.
|
||||
|
||||
The editor uses the current theme and writing direction, local media, zoom,
|
||||
panning, a trash area and Blockly context-menu editing. Language changes preserve
|
||||
the current draft. Per-block disabling and standalone workspace comments are
|
||||
not offered because the existing rule engine has no equivalent stored semantics;
|
||||
rule enabling remains in the existing rule controls. Blockly code generation is
|
||||
never used, and no script or XML from a workspace is executed.
|
||||
|
||||
## How the numbers are calculated
|
||||
|
||||
The view has no numbers of its own. Its limits: a workspace must hold exactly
|
||||
**one** connected trigger and **one** action to save
|
||||
([models/lib/rulesBlocks.js](../../../../models/lib/rulesBlocks.js)); a rule's
|
||||
extra triggers and actions (at most ten of each, `MAX_EXTRA_RULE_PARTS`) are
|
||||
edited in Rule details. The installed Blockly is 13.4.0
|
||||
([package.json](../../../../package.json)); the translation test requires a
|
||||
WeKan key for every one of its catalog messages (701 now,
|
||||
[tests/blocklyTranslations.test.cjs](../../../../tests/blocklyTranslations.test.cjs)).
|
||||
|
||||
## How it works in WeKan
|
||||
|
||||
### Implementation plan
|
||||
|
||||
Add **Blocks** to the existing IFTTT Rules view controls alongside List and
|
||||
Workflow. Use Blockly's Scratch-style connections to represent the existing
|
||||
@@ -24,16 +94,37 @@ Actions as the authoritative data, and keep the existing automation engine.
|
||||
6. Test adapter round trips, malformed workspaces, authorization, lazy loading,
|
||||
real Blockly editing, persistence and actual execution of a saved rule.
|
||||
|
||||
## Scope
|
||||
### Files
|
||||
|
||||
The current engine supports one trigger and one action per rule. This view does
|
||||
not introduce multi-action chains, new condition semantics, loops, executable
|
||||
- [client/components/rules/rulesBlocks.jade](../../../../client/components/rules/rulesBlocks.jade)
|
||||
and `.js` - the view; [client/components/rules/blocks/editor.js](../../../../client/components/rules/blocks/editor.js)
|
||||
- the lazily loaded Blockly editor and the adapter between blocks and rule
|
||||
documents.
|
||||
- `rules.createRule` and `rules.updateRule` - the server methods that save.
|
||||
- Tests: [tests/rulesBlocks.test.cjs](../../../../tests/rulesBlocks.test.cjs),
|
||||
[tests/blocklyTranslations.test.cjs](../../../../tests/blocklyTranslations.test.cjs),
|
||||
and the browser tests
|
||||
[rules-blocks.e2e.js](../../../../tests/playwright/specs/rules-blocks.e2e.js),
|
||||
[rules-history.e2e.js](../../../../tests/playwright/specs/rules-history.e2e.js)
|
||||
and
|
||||
[rules-visibility.e2e.js](../../../../tests/playwright/specs/rules-visibility.e2e.js).
|
||||
|
||||
### Scope
|
||||
|
||||
When this view was added the engine supported one trigger and one action per
|
||||
rule. Since 2026-09-29 a rule may also have up to ten more triggers (any of
|
||||
them fires it) and ten more actions (run in order), added in **Rule details**
|
||||
with **Add another trigger** / **Add another action**
|
||||
([models/lib/ruleParts.js](../../../../models/lib/ruleParts.js)). The Blocks
|
||||
view still connects and saves the rule's own trigger and action pair. This
|
||||
view does not introduce multi-action chains, new condition semantics, loops, executable
|
||||
scripts, or Jira/ScriptRunner imports. Trigger filters remain part of the
|
||||
trigger document. The pasted Autoblocks discussion is UI inspiration, not a
|
||||
source of verified product history or a compatible import format.
|
||||
|
||||
Source comments and documentation are English. UI text uses WeKan translations.
|
||||
All 696 Blockly catalog messages are mapped into WeKan locale files, including
|
||||
All Blockly catalog messages (696 when the view was added; 701 in the
|
||||
installed `blockly` 13.4.0) are mapped into WeKan locale files, including
|
||||
accessibility and programming-block terminology. Translation filling is paused
|
||||
for release at the maintainer's request; catalog completeness and placeholder
|
||||
tests do not establish linguistic
|
||||
@@ -42,36 +133,12 @@ Existing List and Workflow views remain available. Rule storage and export
|
||||
formats remain unchanged; Blockly workspace state is an editing representation,
|
||||
not a second rule database.
|
||||
|
||||
## Dependency references
|
||||
|
||||
- [Blockly source and Apache-2.0 license](https://github.com/RaspberryPiFoundation/blockly)
|
||||
- [Package installation](https://docs.blockly.com/guides/get-started/get-the-code/)
|
||||
- [JSON workspace serialization](https://developers.google.com/blockly/guides/configure/web/serialization)
|
||||
|
||||
|
||||
## Using Blocks
|
||||
|
||||
Open IFTTT Rules and select **Blocks** from the right sidebar. The sidebar also
|
||||
provides direct List, Workflow and History choices. Board administrators can
|
||||
select an existing rule or create a new one, drag a trigger and action into the
|
||||
workspace, connect them, edit their supported fields and save. Use **Edit trigger
|
||||
and action** for advanced settings in the existing form editor. A workspace must
|
||||
contain exactly one connected trigger/action pair to save. Unknown stored
|
||||
parameters are retained rather than discarded.
|
||||
|
||||
The editor uses the current theme and writing direction, local media, zoom,
|
||||
panning, a trash area and Blockly context-menu editing. Language changes preserve
|
||||
the current draft. Per-block disabling and standalone workspace comments are
|
||||
not offered because the existing rule engine has no equivalent stored semantics;
|
||||
rule enabling remains in the existing rule controls. Blockly code generation is
|
||||
never used, and no script or XML from a workspace is executed.
|
||||
|
||||
## History and permissions
|
||||
### History and permissions
|
||||
|
||||
A combined rule edit records its title, enabled state, trigger and action as one
|
||||
entry in the existing board History. Creation, deletion, enable changes, form
|
||||
edits, Workflow saves and Blocks saves use the same history. Choose **History**
|
||||
in the Rules sidebar to view or restore rule versions. Undo/redo also supports
|
||||
under Rules in Board Settings to view or restore rule versions. Undo/redo also supports
|
||||
these entries and refuses to overwrite an intervening edit.
|
||||
|
||||
REST rule creation, edits and deletion also record one attributed entry per
|
||||
@@ -87,7 +154,7 @@ An action targeting another board also requires current write access to that
|
||||
destination. History is not a way to regain revoked permissions. Server-side
|
||||
validation is authoritative even when a browser hides a control.
|
||||
|
||||
## Verification and remaining work
|
||||
### Verification and remaining work
|
||||
|
||||
Node tests use real Blockly workspaces to verify serialization and unknown-field
|
||||
preservation, reject invalid connections and check lazy-loading boundaries.
|
||||
@@ -121,6 +188,22 @@ OK, mathematical notation, URLs and nonlinguistic symbols. This is placeholder
|
||||
coverage, not native-speaker verification; specialist terminology still needs
|
||||
review. Chromium coverage exercises Gujarati block dragging,
|
||||
field editing, saving and context menus. The editor
|
||||
remains available; remaining languages and native terminology review are
|
||||
tracked under TODO Later in [the changelog](../../../../CHANGELOG-big.md).
|
||||
remains available; remaining languages and native terminology review were
|
||||
tracked under TODO Later in [the changelog](../../../../CHANGELOG-big.md), which
|
||||
moved to [TODO.md](../../../../TODO.md) on 2026-11-18; that file has no
|
||||
Blockly entry now.
|
||||
Message coverage and placeholder checks do not imply complete translation.
|
||||
|
||||
## Commits
|
||||
|
||||
- [Rules page: Back to the board](https://github.com/wekan/wekan/commit/34d9817110b37fb6971a8bea8034f0d048928a32)
|
||||
- [The Blocks context menu offers no comment, in any language](https://github.com/wekan/wekan/commit/259c4fc7e82d2b011ba015ffcdfaec7881415700)
|
||||
- [Right-click a block beside its label in the localized browser test](https://github.com/wekan/wekan/commit/5e9c313f03c087a1400a160a015a611206eebebb)
|
||||
- [Give the Rules page the board's right sidebar instead of its own](https://github.com/wekan/wekan/commit/40a4d9b171d82c81df605d564c7d5e90fae9abda)
|
||||
- [Put the Rules views, Blocks among them, under Rules in Board Settings](https://github.com/wekan/wekan/commit/b4217f962d1701000851084abe69c9b36077d2ad)
|
||||
- [Let a rule have several triggers and several actions, edited outside Blocks](https://github.com/wekan/wekan/commit/69eeb00c84e2897e53ea96ef13df9524fc4d432a)
|
||||
- [Isolate shared rule components when editing a rule](https://github.com/wekan/wekan/commit/21cb6e8c86884c2408ac6752aca5e83fc350fd4a)
|
||||
- [Keep shared trigger and action records when deleting a rule](https://github.com/wekan/wekan/commit/7472456adade18a3de69184c7fdb2588cfbf3b0d)
|
||||
- [Record compound Rules REST changes in reversible History](https://github.com/wekan/wekan/commit/e0bcf7bde304d433653b663e32770d293c11fe66)
|
||||
- [Add editable Blockly rules with local translated message catalogs](https://github.com/wekan/wekan/commit/d273b86ed5b4657623b7e9ef865d5162659ce2fd)
|
||||
- [Record rule changes in undoable board History](https://github.com/wekan/wekan/commit/539aef4aa58ec26308d364b864e16002af8b92c8)
|
||||
@@ -1,43 +1,60 @@
|
||||
# Rules (Automation)
|
||||
|
||||
## What it is
|
||||
|
||||
WeKan **Rules** automate your board: when something happens (a **trigger**), WeKan
|
||||
runs a **action**. This is WeKan's equivalent of Trello's Butler.
|
||||
runs an **action**. This is WeKan's equivalent of Trello's Butler.
|
||||
|
||||
Open Rules from the board sidebar → **Board Settings** → **Rules**, or straight
|
||||
into one of its views listed under it: **List view**, **Workflow view**,
|
||||
**Blocks**, **History** or **Import / Export rules**. The Rules page is a
|
||||
**fullscreen page** below the top bar (it used to be a small popup), and its
|
||||
right sidebar is the board's own sidebar, so the same entries are there. Pick a
|
||||
view in the **Board View** menu to go back to the board.
|
||||
|
||||
|
||||
## Showing a board's Rules to its members
|
||||
|
||||
[#2217](https://github.com/wekan/wekan/issues/2217). Rules are edited by board
|
||||
admins only. Members can be shown them, read-only, so they know what happens
|
||||
when they move a card:
|
||||
|
||||
1. **Admin Panel → Settings → Features → Rules**: tick **Boards may show their
|
||||
Rules to members, read-only**. It is off by default.
|
||||
2. On the board's Rules page, a board admin ticks **Show these Rules to board
|
||||
members, read-only**.
|
||||
|
||||
Members of that board then have **Rules** in Board Settings, with the rules
|
||||
list and each rule's details, and no control that changes a rule. The server
|
||||
methods that change rules check for a board admin as before, so this gives
|
||||
nobody a right to change anything. Without both ticks, only board admins see
|
||||
the Rules page.
|
||||
|
||||
## How a rule works
|
||||
|
||||
A rule links one **trigger** to one **action**:
|
||||
A rule links a **trigger** to an **action**:
|
||||
|
||||
> **When** a card is moved to list "Done" → **then** mark the card complete.
|
||||
|
||||
Triggers and actions both support a wildcard `*` meaning "any" (for triggers) or
|
||||
"the card's current value" (for actions).
|
||||
|
||||
## Managing rules
|
||||
A rule may also have up to ten more triggers and ten more actions: open the
|
||||
rule's **Rule details** and use **Add another trigger** or **Add another
|
||||
action** (and **Remove**). *The rule runs when any of its triggers happens. Its
|
||||
actions run in order.* - the rule's own action first.
|
||||
|
||||
## Read more
|
||||
|
||||
- [Event condition action](https://en.wikipedia.org/wiki/Event_condition_action)
|
||||
and [Business rules engine](https://en.wikipedia.org/wiki/Business_rules_engine)
|
||||
on Wikipedia - the trigger-and-action model.
|
||||
- [IFTTT](https://en.wikipedia.org/wiki/IFTTT) - "if this then that", where the
|
||||
rules' original name comes from.
|
||||
- [Trello Butler](https://trello.com/butler) - the Trello automation WeKan's
|
||||
rules correspond to.
|
||||
- [Business process automation](https://en.wikipedia.org/wiki/Business_process_automation)
|
||||
and [Workflow](https://en.wikipedia.org/wiki/Workflow).
|
||||
- [cron](https://en.wikipedia.org/wiki/Cron) - the five-field schedule of the
|
||||
cron trigger.
|
||||
- In WeKan: [IFTTT](../IFTTT/IFTTT.md), [Blocks view](Blocks.md),
|
||||
[Rule suggestions](../Rule-Suggestions.md), [Bots](../Bots.md),
|
||||
[REST API](../../../API/REST-API.md).
|
||||
|
||||
## How to use it
|
||||
|
||||
Open Rules from the board sidebar → **Board Settings** → **Rules**, or straight
|
||||
into one of its views listed under it: **List view**, **Workflow view**,
|
||||
**Blocks**, **History** or **Import / Export rules**. The Rules page is a
|
||||
**fullscreen page** below the top bar (it used to be a small popup), and its
|
||||
right sidebar is the board's own sidebar, so the same entries are there. Click
|
||||
**Back** at the top of the rules list (and of its Workflow, Bots, Blocks and
|
||||
History views) to go back to the board, or pick a view in the **Board View**
|
||||
menu; the trigger, action and rule details pages have their own **Back**, to
|
||||
the rules list.
|
||||
|
||||
**Add a rule**
|
||||
|
||||
1. Open the board's right sidebar → **Board Settings** → **Rules** (or **List
|
||||
view**). You must be a board admin.
|
||||
2. Type a title, pick a trigger and fill in its fields.
|
||||
3. Pick an action and fill in its fields; the rule is saved with it.
|
||||
4. The rule appears in the list; it fires from then on, unless it is disabled.
|
||||
|
||||
### Managing rules
|
||||
|
||||
On the Rules page you can:
|
||||
|
||||
@@ -56,15 +73,104 @@ On the Rules page you can:
|
||||
entirely by dragging. Parameterized rules (a specific list, label, member, or
|
||||
schedule time) are still created with the form builder on the **List view**.
|
||||
|
||||
## Triggers
|
||||
### Showing a board's Rules to its members
|
||||
|
||||
### Event triggers
|
||||
[#2217](https://github.com/wekan/wekan/issues/2217). Rules are edited by board
|
||||
admins only. Members can be shown them, read-only, so they know what happens
|
||||
when they move a card:
|
||||
|
||||
1. **Admin Panel → Settings → Features → Rules**: tick **Boards may show their
|
||||
Rules to members, read-only**. It is off by default.
|
||||
2. On the board's Rules page, a board admin ticks **Show these Rules to board
|
||||
members, read-only**.
|
||||
|
||||
Members of that board then have **Rules** in Board Settings, with the rules
|
||||
list and each rule's details, and no control that changes a rule. The server
|
||||
methods that change rules check for a board admin as before, so this gives
|
||||
nobody a right to change anything. Without both ticks, only board admins see
|
||||
the Rules page.
|
||||
|
||||
### Example: archive completed cards after 90 days
|
||||
|
||||
This common "process" works out of the box with a scheduled **card-aging** trigger
|
||||
plus the **archive** action:
|
||||
|
||||
> **When** a card has been in list **"Completed"** for **90** days (checked daily)
|
||||
> → **then** archive the card.
|
||||
|
||||
Create it on the Rules page (Scheduled triggers → "card in list for N days"), or via
|
||||
the [REST API](#rest-api).
|
||||
|
||||
## How the numbers are calculated
|
||||
|
||||
- **Scheduled triggers** are checked by one server cron job **every minute**
|
||||
(`wekan-scheduled-rules`, `parser.text('every 1 minute')` in
|
||||
[server/scheduledRules.js](../../../../server/scheduledRules.js)). A trigger
|
||||
with a time (`atTime`, `HH:MM`, server local time) runs in the minute that
|
||||
matches, at most once per minute (`lastRunKey` is the date and minute). A
|
||||
cron trigger is matched in UTC ([models/lib/cronSchedule.js](../../../../models/lib/cronSchedule.js)).
|
||||
- **Calendar schedules**: *every weekday* is Monday to Friday; *every week* is
|
||||
the chosen weekday; *every month* the chosen day of the month; *once* the
|
||||
chosen date.
|
||||
- **Card aging**: the days a card has been in its list are
|
||||
`(now - time of its latest moveCard or createCard activity) / 86,400,000 ms`
|
||||
(the card's creation date when it has no such activity); the trigger acts on
|
||||
cards whose value is at least N.
|
||||
- **Due date**: *set* matches any card with the date; *approaching* matches
|
||||
a date in the future no more than N × 24 hours away; *overdue* matches a date
|
||||
at least N × 24 hours in the past
|
||||
([models/lib/scheduledDueFilter.js](../../../../models/lib/scheduledDueFilter.js)).
|
||||
The trigger can watch the start date instead of the due date.
|
||||
- **Rule parts**: at most 10 extra triggers and 10 extra actions per rule
|
||||
(`MAX_EXTRA_RULE_PARTS` in [models/lib/ruleParts.js](../../../../models/lib/ruleParts.js)).
|
||||
- **Rules started by rules** stop at a depth of 5 (`MAX_RULE_DEPTH` in
|
||||
[server/rulesHelper.js](../../../../server/rulesHelper.js)); the refusal is
|
||||
recorded in Admin Panel → Problems.
|
||||
- **Rule e-mails**: at most 100 attachments and 8 MiB of raw file data per
|
||||
message (`MAX_ATTACHMENTS`, `MAX_ATTACHMENT_BYTES` in
|
||||
[server/lib/ruleEmailAttachments.js](../../../../server/lib/ruleEmailAttachments.js));
|
||||
the attachment manifest at most 256 KiB
|
||||
([server/lib/ruleCardAttachments.js](../../../../server/lib/ruleCardAttachments.js));
|
||||
the card's discussion, its Details and a linked board's discussion at most
|
||||
768 KiB of rendered text each, and a linked board's discussion at most 1,000
|
||||
comment rows
|
||||
([server/lib/ruleBoardDiscussion.js](../../../../server/lib/ruleBoardDiscussion.js)).
|
||||
- **Relative date action**: "+N" minutes, hours, days, weeks or months from
|
||||
the moment the rule runs.
|
||||
|
||||
## How it works in WeKan
|
||||
|
||||
- **Collections**: `Rules` ([models/rules.js](../../../../models/rules.js)),
|
||||
`Triggers` and `Actions`; a rule keeps `triggerId`/`actionId` and the optional
|
||||
`extraTriggerIds`/`extraActionIds`.
|
||||
- **Running**: `RulesHelper` in
|
||||
[server/rulesHelper.js](../../../../server/rulesHelper.js) matches each new
|
||||
activity against the board's own triggers and performs the actions; a
|
||||
disabled rule never fires. Scheduled rules are
|
||||
[server/scheduledRules.js](../../../../server/scheduledRules.js); they act as
|
||||
the board's admin.
|
||||
- **Page**: [client/components/rules/rulesMain.jade](../../../../client/components/rules/rulesMain.jade)
|
||||
and its views (`rulesList`, `rulesWorkflow`, `rulesBots`, `rulesBlocks`,
|
||||
`rulesImportExport`, `ruleDetails`).
|
||||
- **Permissions**: the methods that change rules check for a board admin, and
|
||||
an action that targets another board needs write access to it; read-only
|
||||
display is decided by [models/lib/rulesReadOnly.js](../../../../models/lib/rulesReadOnly.js).
|
||||
- **Tests**: many `tests/rule*.test.cjs` suites, e.g.
|
||||
[tests/ruleSuggestions.test.cjs](../../../../tests/ruleSuggestions.test.cjs)
|
||||
and [tests/rulesBlocks.test.cjs](../../../../tests/rulesBlocks.test.cjs), and
|
||||
the browser tests [20-rules.e2e.js](../../../../tests/playwright/specs/20-rules.e2e.js),
|
||||
[44-rules.e2e.js](../../../../tests/playwright/specs/44-rules.e2e.js) and
|
||||
[rules-history.e2e.js](../../../../tests/playwright/specs/rules-history.e2e.js).
|
||||
|
||||
### Triggers
|
||||
|
||||
#### Event triggers
|
||||
- **Board:** card created / moved (to or from a list) / archived / unarchived /
|
||||
**commented on** (a comment was added to the card).
|
||||
- **Card:** label added/removed, member added/removed, attachment added/removed.
|
||||
- **Checklist:** checklist added/removed/completed, item checked/unchecked.
|
||||
|
||||
### Scheduled triggers (time-based)
|
||||
#### Scheduled triggers (time-based)
|
||||
Evaluated by a server cron job every minute:
|
||||
|
||||
- **On a schedule:** once on a date, every day, every weekday, every week (pick a
|
||||
@@ -82,13 +188,13 @@ Evaluated by a server cron job every minute:
|
||||
A **disabled** rule never fires: not on an event, not on a schedule and not
|
||||
from its button.
|
||||
|
||||
### Button triggers (manual)
|
||||
#### Button triggers (manual)
|
||||
- **Card button:** appears on the card detail; runs the action on that card when
|
||||
clicked.
|
||||
- **Board button:** appears in the **board header**; runs a board-level action on
|
||||
demand.
|
||||
|
||||
## Actions
|
||||
### Actions
|
||||
|
||||
- **Board:** move card to top/bottom (of its list or a named list/board), archive /
|
||||
unarchive, add swimlane, create card, copy card, link card, **sort a list** (by due date /
|
||||
@@ -102,7 +208,7 @@ from its button.
|
||||
a checklist with items.
|
||||
- **Mail:** send an email.
|
||||
|
||||
### Attach card files to an email
|
||||
#### Attach card files to an email
|
||||
|
||||
Enable **Attachments** in the email action to include the triggering card's
|
||||
live files. The default remains a text-only message. Files are read through the
|
||||
@@ -188,7 +294,7 @@ evidence, remain readable but cannot be dispatched or
|
||||
silently recaptured; operator recovery for those commands remains unfinished.
|
||||
Ordinary event, button and scheduled email rules also support linked sources.
|
||||
|
||||
### Copy a card after a trigger
|
||||
#### Copy a card after a trigger
|
||||
|
||||
In the form builder, choose **Copy Card** under Board actions and select the
|
||||
board, list and swimlane. The original card stays in place; an independent copy
|
||||
@@ -206,7 +312,27 @@ Copies may trigger other rules. The same copy action runs only once in a
|
||||
causal chain, preventing a create-card rule from endlessly copying its own
|
||||
copies. Separate user events can each make a copy.
|
||||
|
||||
## Variables
|
||||
#### Linked cards in rule emails
|
||||
|
||||
With Details enabled, a linked card or linked board also includes a separate
|
||||
`Linked card local details` section for its local board/list/swimlane placement,
|
||||
local recurrence, persisted timer fields and visible local Scrum metadata.
|
||||
Source Details keeps its own scope. Copied source-card titles, descriptions,
|
||||
stickers and custom fields are not
|
||||
exported from a linked-card wrapper. A linked-board wrapper owns its local
|
||||
labels, stickers, custom fields, notes, locations, creator and relationships;
|
||||
These use local field visibility and related-card access checks. Public timer
|
||||
owner names and same-board Scrum names use the same access rechecks.
|
||||
|
||||
A linked-board card's Discussion choice also includes public comments from
|
||||
readable cards on the target board, grouped by current card title. Assigned-only
|
||||
membership still limits which cards can contribute. Missing/deleted cards and
|
||||
unreadable linked sources are omitted. Access is checked again after rendering
|
||||
and before a stored command is sent. Checklists and files remain local to the
|
||||
linked-board card. Board discussion rejects more than 1,000 discovered comment
|
||||
rows or 768 KiB of rendered text; it does not send an incomplete subset.
|
||||
|
||||
### Variables
|
||||
|
||||
Action text fields support Trello-Butler-style **variables** in `{name}` form,
|
||||
substituted when the rule runs. They work in the email subject/body, the created
|
||||
@@ -223,22 +349,18 @@ card name, and created checklist/swimlane names:
|
||||
| `{boardname}` | the board's title |
|
||||
| `{username}` | the user who triggered the rule |
|
||||
| `{date}` / `{time}` / `{datetime}` | the current date / time / both |
|
||||
| `{card}`, `{list}`, `{board}` | short names for `{cardname}`, `{listname}`, `{boardname}` |
|
||||
| `{cardlink}` | a direct link to the card |
|
||||
| `{member}` / `{membername}` | the member the trigger is about (added, removed, assigned ...), else the user who triggered the rule |
|
||||
| `{creator}`, `{assignees}`, `{members}` | the card's creator, assignees and members by username; as an e-mail recipient, their e-mail addresses |
|
||||
| `{customField:Name}` | the card's value of the custom field called Name (case-insensitive; admin-only fields are not read) |
|
||||
|
||||
Example email body: `Card {cardname} (#{cardnumber}) moved on {datetime} by {username}`.
|
||||
Unknown `{tokens}` are left unchanged.
|
||||
Unknown `{tokens}` are left unchanged, and so is a custom field the card has no
|
||||
value for. Token names are case-insensitive. Variables are also accepted in
|
||||
trigger values. The date and time use the server's locale.
|
||||
|
||||
## Example: archive completed cards after 90 days
|
||||
|
||||
This common "process" works out of the box with a scheduled **card-aging** trigger
|
||||
plus the **archive** action:
|
||||
|
||||
> **When** a card has been in list **"Completed"** for **90** days (checked daily)
|
||||
> → **then** archive the card.
|
||||
|
||||
Create it on the Rules page (Scheduled triggers → "card in list for N days"), or via
|
||||
the [REST API](#rest-api).
|
||||
|
||||
## Import / Export
|
||||
### Import / Export
|
||||
|
||||
Click **Import / Export rules** on the Rules page, or in Board Settings under
|
||||
**Rules**.
|
||||
@@ -253,7 +375,7 @@ Click **Import / Export rules** on the Rules page, or in Board Settings under
|
||||
defaults to the current board). This applies to every importer in the dialog
|
||||
(JSON, CSV, Trello Butler, visual workflows and Wrike workflows).
|
||||
|
||||
### Importing visual workflows (n8n / Node-RED)
|
||||
#### Importing visual workflows (n8n / Node-RED)
|
||||
|
||||
The Import / Export dialog can import a visual workflow exported from **n8n** or
|
||||
**Node-RED** (auto-detected, or pick the format). The workflow graph's
|
||||
@@ -266,7 +388,7 @@ reported. The rules are created in the **board you selected** under *Import targ
|
||||
> Importing rules/workflows *with* a whole board is supported for WeKan→WeKan (see
|
||||
> below); n8n/Node-RED bring workflows only, into a chosen existing board.
|
||||
|
||||
### GitHub Actions workflows
|
||||
#### GitHub Actions workflows
|
||||
|
||||
The [GitHub organization import](../../Board-Header/Board-Views/Version-Control-View.md#github-organization)
|
||||
turns each `.github/workflows/*.yml` file of a repository into rules on that
|
||||
@@ -281,7 +403,7 @@ script or any other code is never run by WeKan: such a workflow is imported
|
||||
what did not map. The rule keeps WeKan's own permissions: it can do only what
|
||||
a rule can do on that board.
|
||||
|
||||
### Wrike workflows
|
||||
#### Wrike workflows
|
||||
|
||||
A Wrike workflow is an ordered list of statuses, each in one of four status
|
||||
groups: **Active**, **Completed**, **Deferred** or **Cancelled**. Moving a task
|
||||
@@ -319,7 +441,7 @@ matching case. Wrike's own automation rules (WHEN–IF–THEN) have no export,
|
||||
import or API, so they cannot be brought into WeKan, and WeKan rules other than
|
||||
the ones above have no Wrike counterpart.
|
||||
|
||||
### Importing a whole board with its workflows (WeKan → WeKan)
|
||||
#### Importing a whole board with its workflows (WeKan → WeKan)
|
||||
|
||||
A WeKan board export already contains its rules/triggers/actions, so importing a
|
||||
board brings its **workflows and all other data** with it:
|
||||
@@ -328,14 +450,14 @@ board brings its **workflows and all other data** with it:
|
||||
- Over REST: `POST /api/boards/import` with `{ "board": <export JSON> }`
|
||||
(`python3 api.py importboard EXPORT.json`).
|
||||
|
||||
### Migrating all boards + workflows + rules from another WeKan
|
||||
#### Migrating all boards + workflows + rules from another WeKan
|
||||
|
||||
`python3 api.py migratefromwekan REMOTE_URL REMOTE_USER REMOTE_PASS` logs in to a
|
||||
remote WeKan, lists that user's boards, exports each (full JSON incl. rules), and
|
||||
imports each into your WeKan via `POST /api/boards/import`. The remote fetch is done
|
||||
by the client/script (not the server), so no arbitrary-URL fetch happens server-side.
|
||||
|
||||
### Importing rules from Trello
|
||||
#### Importing rules from Trello
|
||||
|
||||
Trello's board export does **not** contain Butler rules/automation (confirmed: the
|
||||
Trello importer never receives them). So rules cannot be imported automatically from
|
||||
@@ -344,14 +466,14 @@ paste your Butler command text and WeKan maps the recognizable subset (for examp
|
||||
"when a card is added to list X, move the card to the top") and reports the lines it
|
||||
could not map.
|
||||
|
||||
### Importing rules from Jira
|
||||
#### Importing rules from Jira
|
||||
|
||||
Jira board/data import lives under **All Boards → New → Import → Jira** (see
|
||||
[Jira import](#jira-import)). If the Jira JSON includes an `automationRules` array in
|
||||
the WeKan `{ title, trigger, action }` shape, those rules are imported with the board
|
||||
(best effort).
|
||||
|
||||
## Jira import
|
||||
### Jira import
|
||||
|
||||
WeKan can import boards from Jira, similar to Trello:
|
||||
|
||||
@@ -367,7 +489,7 @@ Jira **statuses become lists** (the workflow columns), each **issue becomes a ca
|
||||
become board labels**, and assignees become card members. An optional
|
||||
`automationRules` array is imported as WeKan rules.
|
||||
|
||||
## REST API
|
||||
### REST API
|
||||
|
||||
Manage rules over REST (see also [`api.py`](../../../../api.py)
|
||||
`addrule` / `editrule` / `removerule` / `listrules` / `getrule`):
|
||||
@@ -397,26 +519,39 @@ python3 api.py addrule BOARDID 'On create -> top' \
|
||||
'{"actionType":"moveCardToTop","listName":"*","swimlaneName":"*"}'
|
||||
```
|
||||
|
||||
With Details enabled, a linked card or linked board also includes a separate
|
||||
`Linked card local details` section for its local board/list/swimlane placement,
|
||||
local recurrence, persisted timer fields and visible local Scrum metadata.
|
||||
Source Details keeps its own scope. Copied source-card titles, descriptions,
|
||||
stickers and custom fields are not
|
||||
exported from a linked-card wrapper. A linked-board wrapper owns its local
|
||||
labels, stickers, custom fields, notes, locations, creator and relationships;
|
||||
These use local field visibility and related-card access checks. Public timer
|
||||
owner names and same-board Scrum names use the same access rechecks.
|
||||
|
||||
A linked-board card's Discussion choice also includes public comments from
|
||||
readable cards on the target board, grouped by current card title. Assigned-only
|
||||
membership still limits which cards can contribute. Missing/deleted cards and
|
||||
unreadable linked sources are omitted. Access is checked again after rendering
|
||||
and before a stored command is sent. Checklists and files remain local to the
|
||||
linked-board card. Board discussion rejects more than 1,000 discovered comment
|
||||
rows or 768 KiB of rendered text; it does not send an incomplete subset.
|
||||
|
||||
## Related
|
||||
|
||||
- [IFTTT and Rules](../IFTTT/IFTTT.md)
|
||||
- [Cards](../../Cards/Cards.md), [Swimlanes](../../Swimlanes/Swimlanes.md)
|
||||
- [REST API](../../../API/REST-API.md)
|
||||
|
||||
## Commits
|
||||
|
||||
- [A rule action into a list that refuses the triggering user's role is skipped](https://github.com/wekan/wekan/commit/ee24453dcb5d9ed8af5c07b848cbd5bd8979ae28)
|
||||
- [Scheduled rules act as the board's admin, so their cards have an author](https://github.com/wekan/wekan/commit/f23695cc1bf6447fb38693ea8fe2e1ce4ab51f8f)
|
||||
- [Rules page: Back to the board](https://github.com/wekan/wekan/commit/34d9817110b37fb6971a8bea8034f0d048928a32)
|
||||
- [Rule emails: pick board members for To from a list with autocomplete](https://github.com/wekan/wekan/commit/75e260966b921524b7617ee897f3c4a06596f7b0)
|
||||
- [Rules can be shown to board members, read-only](https://github.com/wekan/wekan/commit/f4a3690256c71909860a830cb8e4557f4a2c4348)
|
||||
- [Import and export Wrike workflows as lists and rules](https://github.com/wekan/wekan/commit/a78b4aa744b011fc385bbd462b83fb092b547efd)
|
||||
- [Rule triggers for a card moved forward or back](https://github.com/wekan/wekan/commit/eac524380f9fba323d394a9c662463212053017f)
|
||||
- [Assignee actions, an optional title, and remove-all members that removes them](https://github.com/wekan/wekan/commit/f735eba194fba0b45d458d1a8cf1547c4f255d8a)
|
||||
- [A chain of rules started by rules stops at a depth limit](https://github.com/wekan/wekan/commit/a8e836efd377e62ff6805a12334d2c2333f63267)
|
||||
- [Rule, webhook and custom-field documents cannot be moved to another board](https://github.com/wekan/wekan/commit/f02da1bfd21f79c10185f199a994839e4c5a660f)
|
||||
- [Put the Rules views under Rules in Board Settings](https://github.com/wekan/wekan/commit/b4217f962d1701000851084abe69c9b36077d2ad)
|
||||
- [Accept rule variables in trigger values](https://github.com/wekan/wekan/commit/b1dbea2152bcd049e6050c0a64956285248a7ad7)
|
||||
- [A rule may have several triggers and several actions](https://github.com/wekan/wekan/commit/69eeb00c84e2897e53ea96ef13df9524fc4d432a)
|
||||
- [Scheduled triggers may watch a card's start date](https://github.com/wekan/wekan/commit/0f8d35fe7265ca21101ac608b5bfd62d94cdd52f)
|
||||
- [People and custom-field variables in action values](https://github.com/wekan/wekan/commit/a9185599390081c8dbc12aa446454be2b3c397dc)
|
||||
- [Include checklists and public comments in rule emails](https://github.com/wekan/wekan/commit/05080fc02e167ef2ca107c9507941dc4b1569fe1)
|
||||
- [Send the card's attachments with email rules](https://github.com/wekan/wekan/commit/846f190690254c20d5f9bd5400964af68f01985b)
|
||||
- [Copy Card rule action with destination pickers](https://github.com/wekan/wekan/commit/998b96bf9150c6123cd9a1a04cc52bf5fb3b44a5)
|
||||
- [Record rule changes in undoable board History](https://github.com/wekan/wekan/commit/539aef4aa58ec26308d364b864e16002af8b92c8)
|
||||
- [Edit a rule's trigger and action in place](https://github.com/wekan/wekan/commit/16c8f425d049b1bc42e81bee787b3cb724ca6d54)
|
||||
- [A card link and short template tokens in the send-email action](https://github.com/wekan/wekan/commit/e643f0da71db3555f50c031a9fd532b092656d2f)
|
||||
- [Add a Remove all labels rule action](https://github.com/wekan/wekan/commit/1c97bbac854f0504376cc3be5f0d99627c4f403d)
|
||||
- [Block unauthorized cross-board rule actions](https://github.com/wekan/wekan/commit/dffe85cce428749908c46ef1cae25fe3fb6edd07)
|
||||
- [Fix rules whose action never ran because the trigger required omitted fields](https://github.com/wekan/wekan/commit/e6b001320c27a11fdbd15e17f2ad230bdeab2290)
|
||||
- [Rules card title filter and the rules REST API](https://github.com/wekan/wekan/commit/25d33cec367b867ea9970e9ad27f723b36135c45)
|
||||
- [A rule can move or link a card to a different board](https://github.com/wekan/wekan/commit/9f7eac158e99f1ae38dedf586bc43225e267722c)
|
||||
- [Unit selector for the relative-date action](https://github.com/wekan/wekan/commit/53328f40c6e092988175ce820c14658c855390de)
|
||||
- [Scheduled rules, the Workflow view, card and board buttons, and rules import/export](https://github.com/wekan/wekan/commit/f0bce67a3bf301c21ded3eb97e84a3be0010290f)
|
||||
Reference in new issue
Block a user