Loading TOC...

alert.actionInsert

alert.actionInsert(
   config-uri as String,
   action as Object
) as null

Summary

This function inserts the specified action into the collection. The caller must have the alert-admin privilege to call this function.

Parameters
config-uri The URI passed to alert.makeConfig.
action The representation of an action.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-alert-admin, http://marklogic.com/xdmp/privileges/xdmp-invoke-modules-change (if changing the modules database), http://marklogic.com/xdmp/privileges/xdmp-invoke-modules-change-fs (if changing the modules db to someplace on the filesystem)

Example

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

  declareUpdate();
  alert.actionInsert(
         "http://acme.com/alert/message-board",
         alert.makeAction(
             "sms",
             "Sends basic SMS text message",
              xdmp.modulesDatabase(),
              xdmp.modulesRoot(),
              "/modules/sms.xqy",
              {"provider":[{"name":"T-Mobile", "domain":"tmomail.net"},
                           {"name":"Virgin", "domain":"vmobl.com"},
                           {"name":"Cingular", "domain":"cingularme.com"},
                           {"name":"Sprint", "domain":"messaging.sprintpcs.com"},
                           {"name":"Verizon", "domain":"vtext.com"},
                           {"name":"Nextel", "domain":"messaging-nextel.com"}]}
   ))
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.