Loading TOC...

alert.makeRule

alert.makeRule(
   $name as String,
   $description as String,
   $user-id as 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
$nameThe name given to the rule.
$descriptionA text description of the rule.
$user-idThe user ID from the security database of the user who will be notified of matches.
$queryThe query that the rule will be matched against for alerting.
$actionThe name of the action to occur upon the matching of the rule.
$options Information specific to the application for the rule.

Example

  var 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"})
  

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy