Overview

Nected's Rule engine offers an easy-to-use no-code editor to build any complex data-driven rules, integrated with your data sources, and thereafter allowing you to seamlessly execute actions on your database and/or trigger any of your internal & external flows based on rule outcome.

Once you integrate Nected with your database and create a dataset for the database connector, you can define conditions that are run on the datasets. The purpose of rules is to create a condition and search the database for that condition, then modify (insert/update) the database records based on the condition results.

Rules help you perform bulk database updates to ensure secure, quick, and accurate insert/update. You can also add a REST API connector using the Add Action option to invoke any of your HTTP-based internal as well as 3rd party APIs.

Setting up Rules

Creating a Nected rule involves the following steps:

  1. Log into your Nected account and select Rules.

  2. Click + Create Rule button and select a rule type.

  3. Click Data Source to add your dataset to the rule. This is optional and you can also set up all custom input params to pass the whole data to Rule instead of reading it from the database, based on your use case.

  4. Define the rule, based on the rule type you selected.

  5. Test the rule and publish the rule in your staging & production environment.

  6. Trigger the rule via API. Refer here for more details.

Demo Rule based on Use Cases

Nected provides a pre-configured read-only rule, named Demo-Discount-Rule, based on the Demo-Product-DataSet. Click the Edit button to check and modify the configuration values for this rule.

The following figure shows the Rules page of the Nected platform:

Rule Types:

Nected supports the following three types of rules:

  1. SimpleRule – A straightforward if/then/else logic-based rule. A Simple Rule is suitable when you have single outcome based on a complex logic or for variety of logics. You can use it if you have complex if/else logic using multiple ANDs/OR in nested format. Simple Rules are ideal for use cases such as customer segmentations, dynamic discounts, recommendations etc.

  2. DecisionTable – A matrix of conditions, outcomes, and actions covering diverse scenarios. Decision Tables are useful for defining multiple conditions and outcomes in a structured tabular format. This rule type is well-suited for use cases where decisions involve evaluating multiple variables or factors and have multiple outcomes based on each combo of variables. Common use cases include complex pricing structures, routing decisions, and product bundling.

  3. Ruleset – A collection of preset rules collaborating for decision-making and action execution. A Ruleset allows you to organize and manage a collection of rules and decisions. This rule type is recommended when you have multiple rules that need to be applied in a specific order or as a group. Rulesets are valuable for scenarios involving lead allocation, referral programs, loyalty/rewards programs, and more.

Rule Environments

Nected Rules enable you to manage rules in multiple environments.

  • Staging – The rule can be tested in a staging environment, which will use staging/ non-production integrations only and can be used to test Nected Rules before publishing. Such rules can be run either directly on the Nected platform via a Test console or via an API.

  • Production – A production rule, that queries as well as performs actions on production integrations. You can trigger rule production only via API and not via Test console since the test console supports testing in the staging environment only.

Rule Components

A Nected rule comprises of four important components –

  • Input Source - you can either pass any custom input parameters to the rule and/or select a dataset to pull the data points directly from your database instead of passing them every time you invoke the rule.

  • Conditions are the logic based on which the rule engine will determine which database rows/input params will be matching and accordingly return the result.

  • Result / Output Data is the output specified of the matching rule condition when you run the condition based on configured input source/params.

  • Action is used for either syncing rule outcomes back in systems or triggering any internal/external flows via the Nected database as well as REST API connectors.

  • Testing & Publishing Rules: You can test rule via the Test console as well as API. You would need to pass isTest:true along with other API params. More info here. There are scenarios in which you won't be able to publish the Rule:

    • Rule showing error while clicking on "Test in Staging"

    • Rule Test was not successful via Test Console

    • The dataset integrated with Rules has not been published yet.

  • Triggering Rule via API: Trigger Nected Rule via API from your systems

Note: Any Rule that will be published without integration being published in production will end up giving an error in the API call response that "connector not published in production".

Rule Status

Based on the current configuration of the rule, it can be in any of the following three states:

  • Draft:

    • The "Draft" status is assigned to a rule when it is either newly created or when an existing published rule is being edited.

    • During the drafting phase, you have the flexibility to make changes and adjustments to your rule without affecting the live environment.

  • Tested:

    • After you have completed the editing process or made changes to a draft rule, you can initiate testing by clicking the "Test in Staging" button.

    • This action redirects you to the testing screen, where you can evaluate the rule's behavior and performance in a controlled staging environment.

    • Once testing is completed and you exit the testing screen, the rule status transitions to "Tested."

  • Live:

    • When you are satisfied with the rule's behavior during testing, you can choose to deploy it by clicking the "Publish" button.

    • Publishing the rule transitions its status to "Live," indicating that it is now active and will be executed in the production environment, making decisions for your customers.

StatesDescAllowed in

Draft

The rule is created/edited and auto-saved, but it is not yet tested.

Testing via UI Console as well via API

Tested

The rule is tested, but it is not yet published.

Testing via UI Console as well via API

Published

The rule is published

Only via API

Refer to State Combinations to know more about possible usage of connectors, datasets, and rules as per their respecitve status.

Managing Rules

Nected enables you to edit, clone, or delete a rule if your business requirement changes.

Follow this procedure to modify a rule:

  1. Log into Nected with your Email ID and password.

  2. Click Rules in the left navigation to open the Rules page.

  3. Select one of the following options based on your requirement.

    1. Click Edit to modify the rule. You can edit the rule name, data source, condition, result, and trigger information of a rule.

    2. Click Clone to duplicate the existing rule. You can modify a cloned rule using the Edit button.

    3. Click Delete to remove a rule from your Nected platform. The Delete Rule dialog box opens. Click the Delete button on the dialog box to remove the rule.

  4. You must update the rulesets after you delete a rule. Otherwise, the ruleset will fail. If the rule you are deleting is part of a ruleset, then you must first remove the rule from the ruleset configuration and then delete the rule.

Versioning

Every time you edit a published dataset, its version is automatically incremented by .10. For example, if the current version is .30, then after you modify the dataset, its version will be .40.

Now that you understand the rules, their types, and states, let us see how to create new rules.

Last updated