Create a Rule in the Rules Engine
This comprehensive guide explains how to create a custom rule in a few simple steps to optimize your processes and enhance your productivity.
In the Rules Engine, you have the ability to create custom rules to automate actions based on certain predefined events.
Accessing the Rules Engine
To begin, navigate to the Rules Engine from the main menu of your application. Here, you'll find all the existing rules and can create new custom rules.
Creating a New Custom Rule
Click on the Create New Rule button to initiate the process of creating your custom rule.
Naming Your Rule
The first step is to assign a name to your custom rule. It's recommended to use clear nomenclature that includes the name of the relevant machine followed by a short description of the rule, facilitating quick identification. For example: MachineX - High Temperature Alert_.
Assigning a Label to the Rule
Next, assign a label to your custom rule. Labels simplify the sorting and management of rules, especially when you have multiple ones. Choose a label that reflects the function or category of the rule.
Configuring the Rule Trigger
The trigger determines the initial conditions that activate the rule.
- Selecting the Trigger Type: Choose from the six available trigger types that best suit your needs. (For more details on the different trigger types, consult the article "Understanding Trigger Types" in this knowledge base.)
- Setting Up the Trigger: Once the trigger type is selected, configure the specific parameters that will correspond to the desired event to trigger the custom rule.
Here's our article to better choose your Trigger.
How to Add Conditions to the Trigger
To refine the triggering of the custom rule, you can add additional conditions by clicking on Add Condition to specify extra criteria that must be met for the custom rule to activate. In practice, conditions are often the state of one or more variables.
Adding Actions to the Rule
Once the trigger and conditions are defined, you need to specify the actions to perform when the custom rule is triggered.
- Selecting or Creating Actions
- If you already have configured actions, you can select them from the list of available actions.
- To create a new action, click on the + Create Action button and configure it according to your needs.
You can add multiple actions to the same custom rule if necessary.
Saving and Submitting the Rule
After configuring all the elements of your custom rule:
- Review: Go over the rule settings to ensure everything is correct.
- Save and Submit: Click on Submit to save and activate your new rule.
Your rule will now appear in the list of rules in the Rules Engine.
How to Manage Your Rules in the Rules Engine
The Rules Engine offers several options to manage your existing rules.
Editing Rule Labels
To modify a rule's label:
- Quick Access: In the list of rules, click on the edit icon next to the rule's label.
- Update: Select or enter the new label, then confirm.
Activating or Deactivating a Custom Rule
You can temporarily prevent a custom rule from triggering without deleting it.
- Use the Status Switch: Toggle the activation switch located next to the rule's name.
- Confirm the Status: The rule's status changes to Active or Inactive accordingly.
Duplicating an Existing Rule
To quickly create a similar rule:
- Duplication Option: Click on the Duplicate option associated with the rule in the list of rules.
- Duplication Settings: Choose the elements to duplicate. You'll be prompted with 3 option
- Only duplicate the trigger: this option is the best when your actions are already created, but unrelated to any existing rule. K2 App will create a new rule, copying only the title, its original tag and its trigger.
- Duplicate the trigger and keep its original actions: this option is the best if you wish to keep the original actions in a new duplicated rule.
- Duplicate the trigger and its actions: this option is perfect if you wish to copy both the trigger and all actions. This is very practical if you want to duplicate a rule from a machine to another one and your actions aren't created yet.
Warning : when option "Duplicate the trigger and keep its original actions" is selected, you'll need to be extremely cautious in order to prevent any edits to original actions involved in the duplicated rule. If not cautious, the original actions will be modified causing your original rule to be corrupted!
Deleting an Unnecessary Rule
If a rule is no longer needed:
- Quick Deletion: Click on the Delete icon next to the concerned rule.
- Confirmation: Confirm the deletion when prompted.
These management options allow you to keep your set of rules organized and tailored to your current needs, optimizing your workflow.
Conclusion
By following these steps, you can build a basic rule that automates key actions in your system. Feel free to explore further advanced features, such as the different types of triggers and complex conditions, to optimize your processes. Screenshots and practical examples are available to visually guide you in creating your custom rules.