Loading TOC...

trgr:get-trigger-by-id

trgr:get-trigger-by-id(
   $trigger-id as xs:unsignedLong
) as element(trgr:trigger)

Summary

Returns the XML representation of the trigger with the given trigger id.

Parameters
trigger-id The trigger id.

Usage Notes

This function must be run in the context of the database containing the trigger to be examined. If no trigger exists with id $trigger-id, the exception TRGR-TRIGGERDNE is raised.

Example

xquery version "1.0-ml";
import module namespace trgr="http://marklogic.com/xdmp/triggers" 
   at "/MarkLogic/triggers.xqy";

(: Run in the context of the database containing the trigger :)
trgr:get-trigger-by-id(7561204940964272849)

  => <trgr:trigger xmlns:trgr="http://marklogic.com/xdmp/triggers">
       <trgr:trigger-id>7561204940964272849</trgr:trigger-id>
       <trgr:trigger-name>myTrigger</trgr:trigger-name>
       <trgr:description>Simple trigger example</trgr:description>
       <trgr:data-event>
         <trgr:directory-scope>
           <trgr:uri>/myDir/</trgr:uri>
           <trgr:depth>1</trgr:depth>
         </trgr:directory-scope>
         <trgr:document-content>
           <trgr:update-kind>create</trgr:update-kind>
         </trgr:document-content>
         <trgr:when>post-commit</trgr:when>
       </trgr:data-event>
       <trgr:module>
         <trgr:database>10570023054829957732</trgr:database>
         <trgr:root>/modules/</trgr:root>
         <trgr:path>log.xqy</trgr:path>
       </trgr:module>
       <trgr:enabled>true</trgr:enabled>
       <trgr:recursive>true</trgr:recursive>
       <trgr:task-priority>normal</trgr:task-priority>
     </trgr:trigger>
  

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