MarkLogic Server 11.0 Product Documentation
alert.makeRule

alert.makeRule(
   name as String,
   description as String,
   user-id as (Number|String),
   query as cts.query,
   action as String,
   options as Object
) as Object

Summary

This function creates the specified rule. If the caller does not have the alert-admin privilege then $user-id must be the ID of the current user from the security database. If $user-id is 0, it will be automatically replaced with the current user's ID.

Parameters
name The name given to the rule.
description A text description of the rule.
user-id The user ID from the security database of the user who will be notified of matches.
query The query that the rule will be matched against for alerting.
action The name of the action to occur upon the matching of the rule.
options Information specific to the application for the rule.

Example

  const alert = require("/MarkLogic/alert.xqy");

  alert.makeRule(
     "nucleic acids email", 
     "Alert me to anything concerning nucleic acids", 
     "0",
      cts.orQuery([
         cts.wordQuery("dna"),
         cts.wordQuery("rna")]),  
     "sms", 
    {"emailAddress":"me@somedomain.com"})
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy