Rule Chain

The Rule Chain feature in Nected allows you to link multiple rules together, forming a sequence where each rule’s outcome determines the next step. This functionality is crucial for automating complex decision-making processes. This guide provides a step-by-step walkthrough for creating a Rule Chain in Nected’s Workflow Editor, focusing on correct rule configuration and enhancement using additional nodes.

Rule Chain in Nected is created by configuring multiple rules within the Workflow Editor.

Steps to Create Rule Chain

Creating a Rule Chain in Nected involves a structured process that begins with setting up a Trigger Node, followed by configuring a sequence of Rule Nodes that evaluate conditions based on your workflow needs. Each Rule Node's output determines the next step, which can include interacting with databases, external APIs, or applying custom logic. This step-by-step approach ensures that your automated workflows are both efficient and aligned with your business processes.

Step 1: Accessing the Workflow Editor

  1. Log in to Nected: Use your credentials to access the Nected dashboard.

  2. Navigate to Workflows: From the main menu, select Workflows.

  3. Create or Edit a Workflow: Choose Create New Workflow to start fresh or select an existing workflow to modify.

Step 2: Adding and Configuring Rule Nodes in Workflow Editor

Nected’s Workflow Editor is a structured interface, where nodes are added and configured systematically.

  1. Adding a Rule Node:

    • Within the Workflow Editor, choose Add Node.

    • From the node selection menu, select Rule Node.

  2. Configuring the Rule Node:

    • Input Params: In this section, you can input constant values (e.g., strings, numbers) or map outcomes from previous nodes using tokens. You can also use global variables by selecting them from the dropdown list. Only compatible data types are shown for selection.

    • Run In Loop: This option allows the rule to execute multiple times in a loop if checked. You can input a list or a custom token created during the trigger configuration to manage iterations.

    • Test Result: After configuring the input parameters, use the 'Test' button to ensure the node functions as expected. The test will show the input and output sections, displaying the execution result in JSON format.

    • Settings: The Settings tab includes broader operational parameters like timeouts and retries. Here, you can toggle between executing actions immediately or waiting for actions to finish before moving to the next node. This ensures that the rule execution aligns with your workflow needs.

    • Save Configuration: After configuration, ensure to save your settings. Testing the node before saving is crucial if you use its output in subsequent nodes.

Step 3: Creating a Rule Chain

  1. Add Multiple Rule Nodes:

  2. Configuring the Rule Chain: Link the nodes logically by determining how the output of one rule will serve as the input or trigger for the next rule.

Configuring Forward Chaining

Forward Chaining in Nected starts with a Trigger Node that initiates the workflow. The sequence progresses through a series of Rule Nodes, where each rule’s outcome determines the next step in the sequence. This is how a forward rule chaining looks like:

Here is how you can create a forward rule chain using Nected:

  • Add a Trigger Node: This node is the entry point for the workflow, triggered by a specific event (e.g., a new customer inquiry).

  • Configure the Trigger Node: Set the conditions that trigger the workflow, such as receiving specific data or an external API call.

  • Add a Rule Node: After the Trigger Node, add a Rule Node to evaluate the first condition.

  • Define the Rule Condition: Specify the conditions under which this rule should execute, using input parameters from the Trigger Node.

  • Test and Save: Test the rule to ensure it behaves as expected before moving to the next step.

  • Sequence the Rules: Continue adding Rule Nodes, each connected to the outcome of the previous one. Ensure that each rule is dependent on the outcome of the previous rule.

Example: After checking the first condition in the rule chain, the flow will check a second condition. If both conditions are met, a database update could be triggered.

  • Add a DB Node: Connect a DB Node to update the database with results from the rule evaluations.

  • Add a REST API Node: Connect a REST API Node to notify external services based on rule outcomes.

  • Add a Response Node: End the workflow with a Response Node to send a confirmation or result to the initiating event.

  • Test the Complete Workflow: Use the Workflow Editor’s testing feature to simulate the entire sequence, ensuring that each node behaves as expected.

  • Deploy the Workflow: Once everything is tested and verified, save and deploy the workflow.

Configuring Backward Chaining

Backward Chaining in Nected starts with a Trigger Node but works backward logically to ensure that all required conditions are met to achieve a desired outcome. However, the sequence still initiates from the Trigger Node in the workflow. A backward rule chain flow looks like this:

Here is how you can create a backward rule chain using Nected:

  • Add a Trigger Node: As with Forward Chaining, the Trigger Node is the starting point for the workflow.

  • Configure the Trigger Node: Define the conditions that initiate the workflow.

  • Add a Goal Node: Conceptually, identify the desired outcome of the workflow (e.g., a specific action or database update).

  • Connect the Goal to Subsequent Rules: Backward chaining will work to meet this goal by evaluating preceding conditions.

  • Start with the Final Condition: Add a Rule Node to check the final condition that must be met to achieve the goal.

  • Work Backward: Continue adding Rule Nodes, each connected to evaluate a condition necessary to meet the previous rule’s requirements.

  • Example: If the goal is to update a record, the preceding rule checks whether the necessary data is available, which in turn depends on the outcome of another rule.

  • Add a DB Node: If a database interaction is needed, add a DB Node to either fetch or update data based on rule outcomes.

  • Add a REST API Node: Use a REST API Node to interact with external services if required by any rule in the backward sequence.

  • Add a Response Node: Include a Response Node to send results back at the end of the workflow.

  • Test the Workflow: Use the testing feature to simulate the backward logic, ensuring that all conditions lead correctly back to the initial trigger.

  • Deploy the Workflow: After testing, save and deploy the workflow.

Enhancing Rule Chains with Additional Nodes

After creating a Rule Chain, you can enhance it by integrating additional nodes such as DB Nodes, REST API Nodes, JavaScript Code Nodes, and Formula Nodes. These nodes allow for more complex operations and data handling.

Using DB Node

A DB Node is useful for interacting with a database after a rule has been executed. For example, if a Rule Node processes a customer’s request, the DB Node can update the database with the processed information.

  1. Add a DB Node:

    • After configuring the Rule Node, select DB Node from the node menu.

    • Connect the output of the Rule Node to the input of the DB Node.

  2. Configure the DB Node:

    • Specify the database operation (e.g., Insert, Update, Select) that should occur based on the rule’s output.

    • Map the fields between the rule's output and the database.

    This setup allows the Rule Chain to dynamically update or retrieve information from your database as part of the workflow.

Using a REST API Node

The REST API Node can send or receive data from external services based on the output of a rule. This is useful for integrating with third-party APIs or microservices.

  1. Add a REST API Node: After a Rule Node, select REST API Node from the same dropdown list.

  2. Configure the REST API Node:

    • Define the API endpoint, method (GET, POST, etc.), and headers.

    • Map the necessary data fields to be sent in the API request.

This allows the Rule Chain to interact with external systems, making it possible to fetch additional data or trigger actions in other services.

Using a Custom Code Node

The Custom Code Node is useful when custom logic needs to be applied to the output of a rule before passing it to the next node.

  1. Write Custom Code: In the configuration panel, input the JavaScript code that processes the rule’s output or enhances it for the next step in the chain.

This is particularly useful for complex transformations or calculations that aren’t covered by standard nodes.

Rule Chaining in Nected offers versatile automation capabilities for various use cases, including:

  • Customer Service: Automatically categorize and route inquiries to the appropriate department based on query type.

  • Finance: Automate approval workflows, escalating approvals based on transaction amounts.

  • E-commerce: Manage personalized promotions triggered by customer behavior, applying discounts or offers.

These use cases demonstrate how Rule Chaining can streamline processes and enhance efficiency across different industries.

Conclusion

This documentation provides a comprehensive guide for creating and enhancing Rule Chains using Nected’s Workflow Editor. By following these detailed steps, you can build sophisticated automation workflows that integrate rules with additional nodes to interact with databases, external APIs, custom logic, and advanced calculations.

This approach allows you to leverage the full potential of Nected, ensuring that your automation processes are both powerful and flexible.

Last updated