📖
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
  • Static properties
  • Methods
  1. Language Reference

System

System actions. For advanced users.

Static properties

appUrl string

Gets the Rulecube application URL. Ends with a forward slash, e.g. https://app.rulecube.com/

apiUrl string

Gets the Rulecube API URL. Ends with a forward slash, e.g. https://app.rulecube.com/api/

Methods

alertInfo

alertInfo(name: string, title: string, message: string, alertOptions?: { 
    type?: "alert" | "warning" | "error",
    name?: string,
    title?: string,
    code?: any,
    property?: string,
    propertyValue?: any,
    ruleId?: any,
    priority?: number,
    group?: string,
    entityName?: string,
    message?: string,
    messageError?: string
})

Creates and triggers an alert with the given message and type 'info'.

Parameters

name string

The name.

title string

The title.

message string

The message.

alertOptions { type?: "alert" | "warning" | "error", name?: string, title?: string, code?: any, property?: string, propertyValue?: any, ruleId?: any, priority?: number, group?: string, entityName?: string, message?: string, messageError?: string}

(optional) The object containing the alert options.

Return type

void

Examples

System.alertInfo('a', 'The title', 'The message.')

alertWarning

alertWarning(name: string, title: string, message: string, alertOptions?: { 
    type?: "alert" | "warning" | "error",
    name?: string,
    title?: string,
    code?: any,
    property?: string,
    propertyValue?: any,
    ruleId?: any,
    priority?: number,
    group?: string,
    entityName?: string,
    message?: string,
    messageError?: string
})

Creates and triggers an alert with the given message and type 'warning'.

Parameters

name string

The name.

title string

The title.

message string

The message.

alertOptions { type?: "alert" | "warning" | "error", name?: string, title?: string, code?: any, property?: string, propertyValue?: any, ruleId?: any, priority?: number, group?: string, entityName?: string, message?: string, messageError?: string}

(optional) The object containing the alert options.

Return type

void

Examples

System.alertWarning('a', 'The title', 'The message.')

alertError

alertError(name: string, title: string, message: string, alertOptions?: { 
    type?: "alert" | "warning" | "error",
    name?: string,
    title?: string,
    code?: any,
    property?: string,
    propertyValue?: any,
    ruleId?: any,
    priority?: number,
    group?: string,
    entityName?: string,
    message?: string,
    messageError?: string
})

Creates and triggers an alert with the given message and type 'error'.

Parameters

name string

The name.

title string

The title.

message string

The message.

alertOptions { type?: "alert" | "warning" | "error", name?: string, title?: string, code?: any, property?: string, propertyValue?: any, ruleId?: any, priority?: number, group?: string, entityName?: string, message?: string, messageError?: string}

(optional) The object containing the alert options.

Return type

void

Examples

System.alertError('a', 'The title', 'The message.')

alert

alert(alertOptions: { 
    type?: "alert" | "warning" | "error",
    name?: string,
    title?: string,
    code?: any,
    property?: string,
    propertyValue?: any,
    ruleId?: any,
    priority?: number,
    group?: string,
    entityName?: string,
    message?: string,
    messageError?: string
})

Creates and triggers an alert with the given options object.

Parameters

alertOptions { type?: "alert" | "warning" | "error", name?: string, title?: string, code?: any, property?: string, propertyValue?: any, ruleId?: any, priority?: number, group?: string, entityName?: string, message?: string, messageError?: string}

The object containing the alert options.

Return type

void

Examples

System.alert({
    type: 'warning',
    name: 'a',
    title: 'The title',
    message: 'The message',
    id: 1001
})

createEntity

createEntity(entityName: string, constructorObject?: { [key: string]: any; })

Creates an entity based on the name. Chain with .to() to cast to the proper Entity type.

Parameters

entityName string

The name of the entity.

constructorObject { [key: string]: any; }

(optional) The object to pass as the parameter to the constructor of the entity.

Return type

RuleSetBaseEntity

Examples

System.createEntity('Person', { Name: 'Test' }).to(Person)    // => a Person entity 

setMetricInput

setMetricInput(metricName: string, metricValue: any)

Sets a metric input by name and value. Will overwrite any existing value by the same name. Note that metrics will need to be enabled in the version settings and execution options for this to work.

Parameters

metricName string

The name of the metric.

metricValue any

The value of the metric.

Return type

void

Examples

System.setMetricInput('Foo', 1)

setMetricOutput

setMetricOutput(metricName: string, metricValue: any)

Sets a metric output by name and value. Will overwrite any existing value by the same name. Note that metrics will need to be enabled in the version settings and execution options for this to work.

Parameters

metricName string

The name of the metric.

metricValue any

The value of the metric.

Return type

void

Examples

System.setMetricOutput('Foo', 1)

setNextInput

setNextInput(inputName: string, nextValue: any)

Instructs the system to use a new value for an input in the next run. Used in combination with System.restart().

Parameters

inputName string

The name of the input.

nextValue any

The value of the input in the next run.

Return type

void

Examples

System.setNextInput('Foo', Foo + 1)

restart

restart()

Instructs the system to run the ruleset again with potentially new input.

Parameters

Return type

void

Examples

System.restart()

stop

stop(message?: string)

Instructs the system to stop ruleset execution.

Parameters

message string

(optional) The message returned by the ruleset as the reason for stopping execution.

Return type

void

Examples

System.stop()
System.stop('stop the ruleset')

getCulture

getCulture()

Returns the current culture (language).

Parameters

Return type

string

Examples

System.getCulture()

isTest

isTest()

Returns whether the system is running in test mode. This is true when a Testcase is executed.

Parameters

Return type

boolean

Examples

System.isTest()

getTestName

getTestName()

Returns the current Testcase name if any.

Parameters

Return type

string

Examples

System.getTestName()

getTestCase

getTestCase()

Returns the current Testcase object if any.

Parameters

Return type

{ [key: string]: any; }

Examples

System.getTestCase()
PreviousStatisticsNextUserStore

Last updated 1 month ago