# Class: AlertRule

## LiveView. AlertRule

#### new LiveView.AlertRule(settings)

  Object that represents an alert rule.

  Name | Type | Description
  --- | --- | ---
  `settings` | Object | optional Object containing initialization values for the new AlertRule
  Name | Type | Description
  --- | --- | ---
  `id` | Number | optional The unique identifier for this AlertRule. Note: if an id value is specified for the AlertRule, it will be honored by the server. However, if an AlertRule already exists on the server with the provided id, that alert rule will be overwritten by rule being sent. It is recommended that the id field be left undefined. When adding the rule to the server, the server will assign a new id.
  `name` | String | optional The name of the AlertRule. This can contain spaces and other symbols.
  `enabled` | boolean | optional A flag indicating whether or not the AlertRule is currently enabled (i.e. is it currently being considered when determining whether to fire an alert).
  `description` | String | optional A description of the rule.
  `severity` | Number | optional A number indicating the severity of alerts created by this rule. Higher numbers correspond to a higher degree of severity. By default, the system uses values 1, 3, and 5 to indicate low, medium, and high degrees of severity.
  `messageTemplate` | String | optional A message template that will be filled in with the specified field values of the tuple that caused the alert. Indicate tuple fields in the template by using the $ symbol. For example "Store $storeNumber is running low on $itemName". When the AlertRule is triggered, the field values of the tuple that caused the alert will be substituted in to the corresponding template locations. Field values for this AlertRule may also be referenced in the message template. Fields: Name, Severity, Created, Owner, and ID may all be referenced by using ${AlertRule.fieldName} in the template string (e.g. "Rule ${AlertRule.Name} just fired!").
  `quiescence` | Number | optional If this AlertRule is triggered, quiescence is the number of milliseconds to delay subsequent triggering. This can be useful if this AlertRule triggers frequently once its condition is met and multiple, repeated alerts are undesired. The delay time starts once the actions for the initial trigger have completed.
  `actions` | Array | optional An array of objects that will be parsed into an array of Action objects.
  `alertQueryConfig` | Object | optional An object that will be parsed into into a QueryConfig. The object should contain fields: predicate, table, predicateDelayInMillis, and queryType.
  `status` | String | optional Indicates whether this AlertRule is in a "valid" or "invalid" state.
  `statusMessage` | String | optional Provides additional details about the current status. If the status is "valid" then statusMessage will just be "OK". If the status is "invalid", the statusMessage will contain more details about why the AlertRule is currently invalid.
  `version` | Object | optional An object that will be parsed into a Version. The object should contain fields: number and string.
  `owner` | String | optional The username of the owner of this AlertRule.
  `lastUpdated` | String | optional A date/time string of the last time this AlertRule was updated.
  `type` | String | optional A string to specify the type of alert (time based or query based).
  `cronString` | String | optional A cron string that defines the behavior of a time based alert.

### Classes

QueryConfig
Version
Action
DeleteRowsAction
ExecJavaAction
ExecOsCommandAction
LVPublishAction
PublishAlertAction
SendEmailAction
SendTupleAction
LVPublishAction

### Members

#### idNumber

  The unique identifier for this AlertRule. Note: if an id value is specified for the AlertRule, it will be honored by the server. However, if an AlertRule already exists on the server with the provided id, that alert rule will be overwritten by rule being sent. It is recommended that the id field be left undefined. When adding the rule to the server, the server will assign a new id.

#### nameString

  The name of the AlertRule. This can contain spaces and other symbols.

#### enabledboolean

  A flag indicating whether or not the AlertRule is currently enabled (i.e. is it currently being considered when determining whether to fire an alert).

#### descriptionString

  A description of the rule.

#### severityNumber

  A number indicating the severity of alerts created by this rule. Higher numbers correspond to a higher degree of severity. By default, the system uses values 1, 3, and 5 to indicate low, medium, and high degrees of severity.

#### messageTemplateString

  A message template that will be filled in with the specified field values of the tuple that caused the alert. Indicate tuple fields in the template by using the $ symbol. For example "Store $storeNumber is running low on $itemName". When the AlertRule is triggered, the field values of the tuple that caused the alert will be substituted in to the corresponding template locations. Field values for this AlertRule may also be referenced in the message template. Fields: Name, Severity, Created, Owner, and ID may all be referenced by using ${AlertRule.fieldName} in the template string (e.g. "Rule ${AlertRule.Name} just fired!").

#### quiescenceNumber

  If this AlertRule is triggered, quiescence is the number of milliseconds to delay subsequent triggering. This can be useful if this AlertRule triggers frequently once its condition is met and multiple, repeated alerts are undesired. The delay time starts once the actions for the initial trigger have completed.

#### actionsArray

  The actions that will execute when this AlertRule is triggered.

#### alertQueryConfigLiveView.AlertRule.QueryConfig

  The query configuration defines the conditions under which this AlertRule will fire an alert.

#### statusString

  Indicates whether this AlertRule is in a "valid" or "invalid" state.

#### statusMessageString

  Provides additional details about the current status. If the status is "valid" then statusMessage will just be "OK". If the status is "invalid", the statusMessage will contain more details about why the AlertRule is currently invalid.

#### versionLiveView.AlertRule.Version

  The version object that has details about the version of this AlertRule.

#### ownerString

  The username of the owner of this AlertRule.

#### lastUpdatedString

  A date/time string of the last time this AlertRule was updated.

#### createdString

  A date/time string of when this AlertRule was created.

#### typeString

  A enumerated string that specifies whether an alert will be a query based alert or a time based alert. In the case of a query based alert, the string should be "query-alert". In the case of a time based alert, the string should be "cron-alert".

#### cronStringString

  In the case of a time based alert, this string specifies the behavior of the time based alert. Please see Quartz Scheduler for documentation.