Rule Chain
Last updated
Last updated
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.
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.
Log in to Nected: Use your credentials to access the Nected dashboard.
Navigate to Workflows: From the main menu, select Workflows.
Create or Edit a Workflow: Choose Create New Workflow to start fresh or select an existing workflow to modify.
Nected’s Workflow Editor is a structured interface, where nodes are added and configured systematically.
Adding a Rule Node:
Within the Workflow Editor, choose Add Node.
From the node selection menu, select Rule Node.
Configure the version: After selecting the rule node, select the specific version that you want to use in the workflow like this:
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.
Add Multiple Rule Nodes:
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.
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.
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.
Before publishing the rule chain, if you're using any draft rule inside your rule chain, then before publishing the rule chain, make sure you change their version to any live version (i.e. either it can be the latest live or any other live version according to your requirement).
Finally, after testing the workflow, you can:
Publish in production: To publish the Rule Chain in production click on the "Publish" button on the bottom right corner.
Request for Review: You can assign someone from your workspace to review your Rule Chain as an Approver, like this:
Note: If you've requested the dataset for a review, then only the reviewer can publish the dataset. Otherwise, you can simply publish the data source by clicking on the Publish button. Read more about it from Approval Flow.
If you edit a published Rule Chain and re-publish the updated Rule Chain, then it creates a new version of it. Now for any reason, if you want to check or roll back to a specific previous version, you can do that using the version Control tab. You can do this in two different ways:
At the top bar, you can see the Environment tabs with numbers written alongside. These numbers show how many versions you have for that environment. Like in the image, you can see that I've 3 Published versions and 1 Draft version of that. Now, you can click on the respective environment to access the Version Control section like this:
The second option is, you click on the just next icon of the settings icon, and it will open the Version Control section and from there you can access it.
To rollback to a previous version just click on the Rollback button on that version.
So, as discussed in the previous section, if you're editing the workflow and then publishing it, then it creates a new version. of the data source. But if you're using the RuleChain in any other workflow, and you want to check which version of the rulechain they're using, then you can do that using the "Dependency Map" section. To do this follow this:
Click on the icon just below the Version Control icon, and it will open the Dependency Map section.
Inside the Dependency Map section, you'll have two tabs:
Using: In this tab, you can check which integration, rule, or workflow, this workflow is using.
Used by: In this tab, you can check which workflow is using this RuleChain along with the version, as shown in the GIF.
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.
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.
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.
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.
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.
Add a REST API Node: After a Rule Node, select REST API Node from the same dropdown list.
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.
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.
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.
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.
Repeat the process in Step 2 to add more Rule Nodes to your workflow.
Add a Custom Code Node: From the dropdown, select Custom Code node and then select Javascript or Formula from the dropdown the output of a Rule Node.