Neo4j Link Staff to User
AI-generatedOverview
This node links an existing staff record to a user account within a Neo4j graph database. It creates a relationship between a Staff node and a User node based on their unique identifiers. This is useful in scenarios where you want to associate employee records with corresponding user accounts, for example, linking HR staff data to system user profiles.
Practical examples include:
- Associating an employee's staff ID with their internal user ID in a company directory.
- Creating relationships in Neo4j to enable queries that combine staff information with user account details.
- Maintaining data integrity by ensuring staff and user nodes are connected properly in the graph.
Properties
| Name | Meaning |
|---|---|
| Staff ID | The unique identifier (staff_id) of the staff member to link. |
| User ID | The internal unique identifier (id) of the user account to link the staff to. |
Output
The node outputs JSON objects for each input item processed. Each output object contains:
success: A boolean indicating if the link was successfully created.staffId: The staff ID used in the operation.userId: The user ID used in the operation.
If the link cannot be created because either the staff or user node does not exist, the node throws an error unless configured to continue on failure, in which case the error details are included in the output JSON under an error field.
No binary data is produced by this node.
Example output JSON:
{
"success": true,
"staffId": "some-staff-uuid",
"userId": "some-user-uuid"
}
Dependencies
- Requires a Neo4j database connection.
- Needs credentials including host, port, username, password, and optionally a database name.
- The node uses the official Neo4j driver to connect and run Cypher queries.
- Proper configuration of the Neo4j API credentials in n8n is necessary.
Troubleshooting
Common issues:
- Missing or incomplete Neo4j credentials will cause the node to fail with a credential configuration error.
- If the specified
staffIdoruserIddoes not exist in the database, the node will throw an error indicating the link was not created. - Connection failures to the Neo4j server due to network issues or incorrect host/port settings.
Error messages:
"Neo4j credentials are not fully configured."— Ensure all required fields (host, port, username, password) are set correctly."Failed to establish Neo4j connection."— Check Neo4j server availability and credentials."Staff ID '...' or User ID '...' not found. Link not created."— Verify that both nodes exist in the database before linking.- Errors related to session or driver closure are logged but do not typically affect execution.
To handle errors gracefully, enable the "Continue On Fail" option in the node settings.
Links and References
- Neo4j Official Documentation
- Cypher Query Language Reference
- n8n Neo4j Integration Guide (for general Neo4j node usage)