📖
Rulecube documentation
v2.4
v2.4
  • Overview
  • Quick Start
  • Tutorial
    • Getting started
    • Create and Run Your First Ruleset
    • Use Constants and Methods
    • Create and Call Functions
    • Adding Testcases
    • Using Lookup Tables
    • Using Entities
    • Using Forms
  • How-to Guides
    • Logging in and Authorization
      • Activate Your Account From an Invitation
      • Log in to Rulecube
      • Change Your Password
      • Recover Your Password
      • Two-factor authentication (2FA)
      • Invite Other Users to Rulecube
      • Edit a User's Role
      • Delete a User
    • Ruleset Development
      • Create a Ruleset
      • Set the Input for a Ruleset
      • Create a Rule
      • Generate Alerts
      • Try out a Ruleset
      • Call a Ruleset from Your Software
      • Entities
        • Create an Entity
        • Drag and Drop a JSON Schema or XSD to create entities
        • Entity instantiation
        • Persisted Entities
      • Constants
        • Constant Tables
      • Functions
      • Built-in Functions
      • Create and Run a Testcase
      • Delete a Ruleset or Components
      • Debugging your Ruleset
    • Create a Workflow
      • Workflow step types
      • Working with documents in a workflow
    • Work with (Environment) Variables
    • Call a Ruleset via Its API From Postman
    • Creating input from JSON Schema
    • Use a Ruleset from Your Software
    • Ruleset Productivity Tips
    • Create an Ockto workflow
    • Alert aggregation
    • Forms
      • Introduction and overview
      • Create a Data table
  • Language Reference
    • Global
    • Array
    • Compression
    • Crypto
    • Date
    • Encryption (deprecated)
    • Finance
    • Http
    • Mail
    • MongoDB
    • Ockto
    • PDF
    • SQL
    • Statistics
    • System
    • UserStore
    • Workflow
Powered by GitBook
On this page
  • Introduction
  • Procedure
  1. How-to Guides
  2. Ruleset Development

Generate Alerts

PreviousCreate a RuleNextTry out a Ruleset

Introduction

This guide explains how to create an alert for a ruleset.

Alerts are a special type of rule that allows you to check whether the input or a calculated result meets business rule conditions. For example, if the age of a new subscriber must be 18 or older, you can have an alert checking the age and signaling a message if the applicant is too young.

Procedure

Let's work the '18 or older'-rule out into an alert. To do so, you'll first create a rule that calculates the age and then an alert that checks the age:

  1. Create a ruleset named AgeCheck.

  2. Create an input named DateOfBirth with Type = date.

  3. Click the + sign behind Rules from the left menu. ↳ The Rule details page opens.

  4. In the Name field, enter the name for the rule. For example, SubscriberAge.

  5. In the Expression field, enter the following code to calculate the age:

    AGE(DateOfBirth)

  6. Click Save.

  7. Click the + sign behind Rules again to create the alert.

  8. In the Name field, enter the name for the rule. For example, AgeCheck.

  9. In the Expression field, enter the following code to calculate the age:

    SubscriberAge < 18

    ↳ This code refers to and uses (the result of) the SubscriberAge rule.

  10. Select the Generate alerts checkbox. ↳ Rulecube adds the Alert settings section to the page.

  11. In the Alert type list, select Error.

  12. In the Title field, enter Too young to subscribe.

  13. Select the Enable expression checkbox.

  14. In the Message field, enter the following expression:

    `The subscriber is ${SubscriberAge} years old and should be 18 or older.`

    Notice the backticks as the expression is template literal.

  15. Click Save followed by Try it out! to open the sandbox for the ruleset.

  16. In the DateOfBirth input, enter a birthdate younger than 18.

  17. Click ▸Execute. ↳ The Results section shows an alert like this:

  18. Now, try the ruleset with a valid birthdate.