Loading TOC...

MarkLogic Server 11.0 Product Documentation
alert.makeAction

alert.makeAction(
   name as String,
   description as String,
   module-db as (Number|String),
   module-root as String,
   module as String,
   options as Object
) as Object

Summary

This function creates the specified action. When a rule associated with the action matches a document, the action's module will be invoked with the following external variables set:

         const configUri;
         const doc;
         const rule;
         const action;
     

All actions must accept these external variables.

Parameters
name The name give to the action.
description A text description of the action.
module-db The database ID where the XQuery modules reside. Use xdmp.modulesDatabase to specify the configured database.
module-root The path to the module root. Use to specify the xdmp.modulesRoot configured root.
module The URI of the module to invoke.
options Optional information specific to the action.

Example

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

  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"}]
    }) 
  => Returns the JSON Object representing an action with the specified information
  

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