I am creating an apoc procedure inside a apoc trigger. The error in the logs says this
"
org.neo4j.exceptions.SyntaxException: Variable node
not defined (line 1, column 26 (offset: 25))
"MATCH(p1:SPerson { name: node.name}) CREATE (p1)-[:Enrolled]->(c)"
"
My apoc trigger code
CALL apoc.trigger.add('loadEnrollments',
"UNWIND apoc.trigger.nodesByLabel($assignedLabels, 'Enrollment') AS node
MERGE (p1:SPerson { name: node.name, cell: node.cell, created_at: node.created_at})
WITH p1, node
MATCH (c:Course {name: 'Paradigm Shifting 101'})
MATCH (n:SPerson)
WITH p1, node, COUNT(n) as size
CALL apoc.do.when(
size>3,'MERGE (p1)-[:Waitlist]->(c)',
'MATCH(p1:SPerson { name: node.name}) CREATE (p1)-[:Enrolled]->(c)') YIELD value
DETACH DELETE node",
{ phase: 'after' });