MarkLogic 9 Product Documentation
alert.createTriggers

alert.createTriggers(
   uri as String,
   events as element(trgr.dataEvent)[]
) as Array

Summary

Create triggers that invoke the standard alerting trigger module. The caller must have the alert-admin privilege. The returned trigger IDs must be associated with the config using alert.configSetTriggerIds and then saving the updated config with alert.configInsert.

Parameters
uri The URI specified to alert.makeConfig.
events Events for which to create triggers.

Example

  var alert = require("/MarkLogic/alert.xqy");
  var trgr = require("/MarkLogic/triggers.xqy");

  declareUpdate();
  alert.configInsert(
      alert.configSetTriggerIds(
          alert.configGet("http://acme.com/alert/message-board"),
          alert.createTriggers(
             "http://acme.com/alert/message-board", 
              trgr.triggerDataEvent(
                   trgr.directoryScope("/myDir/", "1"),
                   trgr.documentContent("create"),
                   trgr.postCommit()))))
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy