Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions content/en/advanced-reference/process-action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Advanced Process
description: Run complex custom tools or special integrations.
weight: 110
aliases:
- /docs/actions/process/
---

# Advanced Process

The **Advanced Process** block is for special tasks that go beyond simple updates or emails.

## When to Use
- **Custom Tools**: Run special tools built by your technical team.
- **Complex Math**: Perform heavy calculations that need extra processing power.
- **Connecting Others**: Talk to other software or services outside of your main system.

## How to Set it Up
1. **Pick the Process**: Select the specific tool or process you want to run.
2. **Fill in Details**: Provide any information the process needs to do its job.
3. **Use the Result**: If the process gives you back a result (like a calculation), you can use that result in the next steps of your rule.

**Note**: This block is usually set up with help from your system administrator or a developer, as it involves specialized system tools.
32 changes: 16 additions & 16 deletions content/en/core-actions/assignment.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
---
title: Assignment
description: Set variables and modify document fields within the rule flow.
title: Set Value (Assignment)
description: Change values or save temporary information for later.
weight: 50
aliases:
- /docs/actions/assignment/
---

# Assignment Action
# Set Value (Assignment)

The **Assignment** action is used to change values in your rule. This can include updating fields on the document currently being processed or setting temporary variables for use in later steps.
The **Set Value** block is used to update information during your rule. You can use it to change fields on the current record or to save a temporary piece of information (a "Variable") to use in a later step.

## Types of Assignments
## Types of Changes

### 1. Document Field Assignment
Directly change a field on the current document (the one that triggered the rule).
- **Example**: Set `status` to "Pending Review".
### 1. Update the Current Record
Directly change a field on the record that started the rule.
- **Example**: Set the `Status` to "Review Required".

### 2. Context Variable Assignment {#context-variables-vars}
Create or update a "Variable" that exists only while the rule is running. This is useful for temporary calculations.
- **Example**: Calculate a total `tax_amount = doc.amount * 0.15`.
### 2. Save for Later (Variables) {#context-variables-vars}
Create a temporary piece of information that only exists while this rule is running. This is great for math or combining text.
- **Example**: Calculate a total with tax: `Total With Tax = Grand Total * 1.15`. You can then use this `Total With Tax` value in a **Notify** or **Update Record** block later on.

## Batch Assignments
You can define multiple assignments within a single node. They are executed sequentially from top to bottom.
## Doing Multiple Things at Once
You can add several changes inside a single **Set Value** block. The system will process them one by one, from top to bottom.

## Normalization and Cleaning
Assignments support "Pipelines" to clean or transform data as it's being set.
- **Example**: Trimming whitespace from a string or converting a name to uppercase.
## Cleaning and Fixing Data
You can also use "Pipelines" to clean up data as you set it.
- **Example**: Automatically remove extra spaces from a name or change text to ALL CAPS.
42 changes: 23 additions & 19 deletions content/en/core-actions/condition.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
---
title: Condition
description: Branch your rule logic based on true/false evaluations.
title: Check (Condition)
description: Split your rule into different paths based on a check.
weight: 40
aliases:
- /docs/actions/condition/
---

# Condition Action
# Check (Condition)

The **Condition** action allows you to create branching logic in your rules. It evaluates a set of rules and directs the execution flow down either a **True** or **False** path.
The **Check** block is how you create "Yes/No" paths in your rule. It looks at your data and decides which way the rule should go.

## How to Configure
## How to Set it Up

### 1. The Rule Builder
Use the integrated condition builder to define your logic.
- **Field**: Select a field from the document or a variable.
- **Operator**: Choose how to compare (e.g., "is", "is not", "contains", "is greater than").
- **Value**: The value to compare against.
### 1. Define the Check
Use the builder to set your rules:
- **What to check**: Pick a field (like `Grand Total` or `Status`).
- **How to compare**: Choose a comparison (like "is greater than", "is not", or "contains").
- **Value**: The thing you're checking against (like `5000` or "Draft").

### 2. Grouping Logic (And/Or)
- **AND**: All conditions in the group must be true.
- **OR**: At least one condition in the group must be true.
### 2. Multiple Checks (And/Or)
- **AND (All)**: Use this if *every* check you list must be true for the rule to follow the "True" path.
- **OR (Any)**: Use this if *any* one of your checks being true is enough to follow the "True" path.

## Simple Example
**Scenario**: Only notify a manager if an order is over $5,000.
1. Add a **Condition** node.
2. Set rule: `grand_total` is greater than `5000`.
3. Connect the **True** path to a **Notify** action.
4. Leave the **False** path empty or connect it to a different step.
## The Two Paths
- **True (Green)**: The rule follows this path if your check passes.
- **False (Red)**: The rule follows this path if your check fails.

## Example
**Scenario**: You only want to alert a manager if an order is over $5,000.
1. Add a **Check** block.
2. Set it to: `Grand Total` is `Greater than` `5000`.
3. Connect the **True** path to a **Notify** block.
4. You can leave the **False** path empty if nothing needs to happen for smaller orders.
12 changes: 8 additions & 4 deletions content/en/core-actions/entry-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ aliases:

# Entry Action

Every business rule starts with an **Entry Action**. This node represents the document and data that triggered the rule.
Every business rule starts with an **Entry Action**. This is the green "Start" block on your map.

## What is the Entry Action?
Think of the Entry Action as the "input" for your logic. It contains the `doc` (the record that triggered the rule) and makes it available to all following steps.
Think of this block as the "input" for your rule. It represents the record (the "Doc") that triggered the rule to run.

Because this is the starting point, all the information from this record is automatically available for you to use in every following step.

## Rule Entry Conditions
You can configure "Entry Conditions" directly on the Rule header. These act as a gatekeeper: if the condition isn't met, the rule won't even start.
You can set "Gatekeeper" rules on the main Rule document. These are called **Entry Conditions**.
- If these conditions aren't met, the rule won't even start.
- **Example**: Only run this rule if the `Customer Type` is "Individual".

**Note**: For branching logic *after* the rule has already started, use the [Condition Action]({{< relref "condition" >}}).
**Tip**: If you want to perform different actions *after* the rule has already started based on certain information, use a [Check (Condition)]({{< relref "condition" >}}) block instead.
28 changes: 14 additions & 14 deletions content/en/core-actions/loop.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
title: Loop
description: Repeat a sequence of actions for each item in a list.
title: Repeat (Loop)
description: Do the same steps for every item in a list.
weight: 60
aliases:
- /docs/actions/loop/
---

# Loop Action
# Repeat (Loop)

The **Loop** action allows you to repeat a series of steps for multiple items. This is essential when you have a list of records (like those from a **Query Records** action) and need to perform the same task for each one.
The **Repeat** block lets you perform the same set of actions multiple times. This is useful when you have a list of items (like a list of overdue invoices) and need to handle each one individually.

## How it Works

1. **Input List**: Select the list of items you want to process.
2. **Loop Flow**: Any actions connected to the loop's output will be executed once for every item in the list.
3. **Current Item**: Inside the loop, you can access the specific item currently being processed.
1. **The List**: You pick a list of items to work through (usually found using a **Query Records** block).
2. **The Steps**: Any blocks you connect to the Repeat block will run once for every item in that list.
3. **The Current Item**: While inside the repeat cycle, you can look at the specific details of the item currently being handled.

## Example
**Scenario**: Send a notification for every overdue invoice found.
1. **Query Records**: Find all "Invoices" where `status` is "Overdue".
2. **Loop**: Connect the results to a Loop node.
3. **Notify**: Inside the loop, use the **Notify** action. It will run for each individual invoice.
**Scenario**: You want to send a reminder for every overdue invoice you found.
1. **Find Records**: Use a **Query Records** block to find all "Invoices" that are "Overdue".
2. **Repeat**: Connect that list to a Repeat block.
3. **Notify**: Connect a Notify block to the Repeat block. The system will now send a separate notification for *each* overdue invoice.

## Best Practices
- **Efficiency**: Only loop over the items you need. Use filters in your query to keep the list small.
- **Complexity**: If your loop logic gets too complex, consider using a **Sub-rule**.
## Simple Tips
- **Keep it Short**: Only repeat over the items you actually need. Use filters when finding your records to keep the list small.
- **Organization**: If you find yourself adding many blocks inside a repeat cycle, consider using a **Sub-rule** to keep your main map clean.
36 changes: 18 additions & 18 deletions content/en/core-actions/notify-action.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
---
title: Notify
description: Send emails, system notifications, or UI toasts.
description: Send emails, system messages, or popup alerts.
weight: 20
aliases:
- /docs/actions/notify/
---

# Notify Action
# Notify

The **Notify** action is used to communicate information to users or external systems.
The **Notify** block is how your rule talks to people or other systems.

## Notification Types
## Types of Notifications

### 1. Email
Send a formatted email to one or more recipients.
- **Recipients**: Use static email addresses or dynamic ones (e.g., `doc.owner`).
- **Templates**: Select from existing Frappe Email Templates or write custom content.
- **Attachments**: Attach the current document as a PDF.
Send a formatted email.
- **Who gets it**: Enter an email address or pick a field (like "Owner's Email").
- **What it says**: Use a pre-made template or write your own message.
- **Attachments**: You can automatically attach the record (like a Sales Order) as a PDF.

### 2. System Notification
Create a notification within the Frappe Desk for a specific user or role. These appear in the notification bell icon.
### 2. System Message
Send an alert inside the system. These show up in the "Bell" icon at the top of the screen for specific users or roles.

### 3. UI Toast
Display a temporary popup message (Toast) to the user who triggered the rule.
- **Types**: Success, Info, Warning, or Error.
- **Note**: This only works for rules triggered by manual UI actions (e.g., clicking Save).
### 3. Popup Alert (Toast)
Show a small popup message to the person who is currently using the system.
- **Alert Types**: Success (Green), Info (Blue), Warning (Yellow), or Error (Red).
- **Note**: These only appear if the rule was triggered by someone clicking a button (like "Save") in the browser.

## Configuration Steps
1. **Select Type**: Choose how you want to notify.
2. **Define Content**: Write your message. You can use `{{ doc.name }}` to include data from the document.
3. **Set Recipients**: Choose who should receive the notification.
## How to Set it Up
1. **Pick the Type**: Choose how you want to send the message.
2. **Write the Message**: Type your message. You can include data from your rule by using curly brackets, like `Hello {{ doc.owner }}`.
3. **Choose the Audience**: Select who should receive the alert.
21 changes: 0 additions & 21 deletions content/en/core-actions/process.md

This file was deleted.

63 changes: 25 additions & 38 deletions content/en/core-actions/query-records.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,43 @@
---
title: Query Records
description: Retrieve data from the system using filters and aggregations.
description: Find and retrieve data from other parts of the system.
weight: 10
aliases:
- /docs/actions/query-records/
---

# Query Records

The **Query Records** action allows your rule flows to fetch information from the database. It is the primary way to make decisions based on data that isn't already present in your current document.
The **Query Records** block lets you "look up" information that isn't already in the record that started the rule.

## When to Use
- **Data Enrichment**: Fetching related fields (e.g., getting a Customer's "Territory").
- **Validation**: Checking for duplicates or conflicting records.
- **Aggregations**: Calculating totals across multiple documents (e.g., "Sum of all unpaid invoices").
## When to use it
- **Find Details**: Get a customer's address from their record when you're processing an order.
- **Check for Others**: Look for other unpaid invoices for the same customer.
- **Get Totals**: Calculate the total amount of all orders placed today.

## Query Modes
## Ways to Find Information

| Mode | Returns | Best For |
| Way to Find | What it gives you | Best for... |
| :--- | :--- | :--- |
| **Query List** | List of Records | Finding multiple records to loop over. |
| **Query Doc** | Single Record | Fetching detailed info from a specific record. |
| **Exist Record** | Yes/No | Simple validation and existence checks. |
| **Aggregations** | Number | Totals, counts, and averages (Sum, Min, Max). |
| **Group By** | List of Totals | Summary data grouped by a category (e.g., Sales by Territory). |
| **Find Single** | One specific record | Getting details from one item (e.g., a specific Customer). |
| **Find Many** | A list of records | Finding multiple things to work with (e.g., all "Draft" invoices). |
| **Check if Exists** | A Yes or No | Simple checks (e.g., "Is there already a record with this ID?"). |
| **Calculate Total** | A single number | Getting a Count, Sum, or Average. |

## Advanced Querying
## How to Set it Up

### Aggregations
Use this mode when you only need a single number.
- **Count**: How many records match the filter.
- **Sum**: The total of a specific numeric field.
- **Average/Min/Max**: Standard statistical calculations.
### 1. Choose the Record Type
Pick what you are looking for (e.g., "Sales Invoice" or "Supplier").

### Group By
Use this to summarize data into "buckets".
- **Example**: Get the total sales amount for each individual salesperson in the last month.
### 2. Set the Filters
Filters tell FlexiRule exactly which records you want.
- **Fixed Filter**: `Status` is "Draft".
- **Matching Filter**: `Customer` matches the `Customer` on the current order.
- **Time Filter**: Find records from the "Last 7 Days".

## How to Configure
### 3. Refresh Data (Important)
Once you've set your filters, click **Refresh Schema**. This tests your lookup and makes all the information it finds available for you to use in the next blocks of your map.

### 1. Select the DocType
Choose the type of record you want to find (e.g., "Sales Invoice").

### 2. Define Filters
Filters tell FlexiRule exactly which records to find.
- **Static Filters**: `status = "Draft"`
- **Dynamic Filters**: `customer = doc.customer` (matches the customer from the current document).
- **Date Formulas**: Use the formula builder for rolling windows like "Last 7 Days".

### 3. Refresh Schema (Important)
After setting your query, click the **Refresh Schema** button. This performs a live test and makes the resulting fields available to use in later steps of your rule.

## Common Tips
- **Always Filter**: Avoid searching the entire database without filters to keep your rules fast.
- **Check the Result**: Remember that **Query List** always returns a list of items, even if it only finds one. Use **Query Doc** if you only need one specific record.
## Simple Tips
- **Be Specific**: Always use filters so the system doesn't have to look through every single record, which keeps things fast.
- **One vs. Many**: If you only need one specific record (like a Customer), use **Find Single** (Query Doc). If you need a list to work through, use **Find Many** (Query List).
25 changes: 14 additions & 11 deletions content/en/core-actions/stop-error.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
---
title: Stop and Error Handling
description: Control how a rule finishes or handle errors.
title: Stop and Errors
description: Control how a rule finishes or block actions with an error.
weight: 100
aliases:
- /docs/actions/stop/
- /docs/actions/raise-error/
---

# Stop and Error Handling
# Stop and Errors

These nodes allow you to explicitly control the end of a rule or handle situations where something goes wrong.
These blocks give you final control over how a rule finishes its work.

## Stop Action
The **Stop** action immediately ends the execution of the rule.
- **Use Case**: Use this inside a **Condition** to exit a rule early if certain criteria aren't met, preventing subsequent actions from running.
## Stop
The **Stop** block tells the rule to finish immediately.
- **When to use it**: Use this if you want to exit a rule early. For example, if a check fails and there's no more work to do, just use a Stop block to end the process cleanly.

## Raise Error Action
The **Raise Error** action stops the rule and displays an error message to the user.
- **Use Case**: Use this for strict validation. For example, if a Sales Order is missing a required attachment, you can "Raise Error" with a custom message like "Please upload the signed contract before submitting."
- **Visual Feedback**: In the Frappe UI, this will appear as a standard error popup.
## Raise Error
The **Raise Error** block stops the rule and shows a warning message to the user.
- **When to use it**: Use this for strict rules. For example, if a Sales Order is missing an important attachment, you can use a **Raise Error** block with the message: *"Please upload the signed contract before saving."*
- **What happens**: The system will stop everything, and the user will see your message in a popup.

## Simple Tip
- **Stop vs. Error**: Use **Stop** when everything is fine but the rule is just done. Use **Raise Error** when something is wrong and the user needs to fix it before they can continue.
Loading
Loading