
trgr.getTriggerById( trigger-id as (Number|String) ) as element(trgr.trigger)
Returns the XML representation of the trigger with the given trigger id.
| Parameters | |
|---|---|
| trigger-id | The trigger id. |
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.
// Run in the context of the database containing the trigger.
const trgr = require('/MarkLogic/triggers');
trgr.getTriggerById(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.json</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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.