Apoc trigger parametrized query

I've opened this issue because I think that the Run function does not perform the parameter substitution but I'm not sure if the code that I wrote is wrong or the problem is in the driver...


As Florent rightly said into the GitHub issue thread,
the $idP present in the second parameter of apoc.trigger.add is entirely managed by APOC.

Anyway, luckily is possible to pass a configuration to "transfer" your parameter from go-driver to apoc, see here in "optional params" section.
That is, you could change your query in this way, by adding {params: {idP: $idP}}:

CALL apoc.trigger.add("create-rel", 
			"UNWIND $createdNodes as node WITH node
			WHERE (node:A)
			MATCH (p:P) WHERE id(p) = toInteger($idP)
			MERGE (p)-[r:REL]->(node)",
       		{phase: 'before'}, {params: {idP: $idP}})

I haven't replicated the problem with Go because I don't know it, but via Neo4j Desktop,
however I believe it should work here too.

Hi @giuseppe_villan.

Thank you for your response and solution; it worked well.
Sorry I've missed the additional params parameter.