Showing results for 
Search instead for 
Did you mean: 

Using triggers with custom procedures

Node Link

I want to use triggers to track changes in the database and once the trigger is fired I want to call a custom procedure. From the trigger I can pass the transactionId to the procedure. How can I get the transaction metadata in the custom procedure from the transaction Id? Is there any way to fetch the transaction metadata within the user procedure?

CALL apoc.trigger.add('my-trigger',
UNWIND apoc.trigger.nodesByLabel($assignedLabels, "Person") AS node
CALL my.change.log(labels(node), node, "name", $transactionId)
RETURN count(*)
, {phase:'after'})

Please provide the following information if you ran into a more serious issue:

  • neo4j version - 4.1.1, desktop version = 1.2.7
    Libraries used

Just sent an PR, see
This should be part of next apoc release for 4.1.

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.