Neo4j Set Staff Availability
Neo4j Set Staff Availability
AI-generatedOverview
This node sets or updates the availability schedule for a specified staff member in a Neo4j database. It completely replaces all existing availability records for that staff member with new data provided as JSON input.
Typical use cases include managing employee work schedules and exceptions such as holidays or special availability changes. For example, you can define regular weekly working hours (SCHEDULE) and specify particular dates when the employee is unavailable or has modified hours (EXCEPTION).
Practical examples:
- Setting a staff member’s normal weekly schedule to Monday-Friday, 9 AM to 5 PM.
- Marking December 25th as a full-day holiday exception where the staff member is not available.
Properties
| Name | Meaning |
|---|---|
| Staff ID | The unique identifier (UUID) of the target staff member whose availability is being set or updated. |
| Availability Data | A JSON array describing the staff member's availability periods. Each entry must be either a SCHEDULE or an EXCEPTION type: - SCHEDULE: Defines recurring weekly availability with day_of_week (1-7 or weekday name), start_time and end_time in "HH:MM" format.- EXCEPTION: Defines specific date exceptions with date (YYYY-MM-DD), start_time, end_time, and optional reason. Full-day unavailability is represented by "00:00" to "23:59". |
Output
The node outputs JSON objects for each processed input item containing:
success: Boolean indicating if the operation succeeded.staffId: The staff member’s ID for whom availability was set.deletedCount: Number of previous availability records deleted.availabilitySetCount: Number of new availability records created.processedEntries: Number of availability entries processed from the input.
If errors occur and the node is configured to continue on failure, the output includes error details with messages and expected input format guidance.
No binary data is produced.
Dependencies
- Requires a Neo4j database connection with credentials including host, port, username, password, and optionally 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
- Invalid JSON in Availability Data: The input must be a valid JSON array. Errors parsing this will cause the node to fail.
- Missing or Incorrect Fields: Each availability entry must have required fields (
type,day_of_weekordate,start_time,end_time). Missing or invalid values trigger errors. - Time Format Errors:
start_timeandend_timemust be in "HH:MM" format, andstart_timemust be earlier thanend_time. - Day of Week Errors: For SCHEDULE entries,
day_of_weekmust be an integer 1-7 or a valid English weekday name. - Staff ID Not Found: If the specified staff ID does not exist in the database, the node throws an error.
- Neo4j Connection Issues: Misconfigured credentials or unreachable database cause connection failures.
Error Messages and Resolutions
"Neo4j credentials are not fully configured."
Ensure all required credential fields (host, port, username, password) are correctly set in n8n."Availability Data must be a valid JSON array."
Check the JSON syntax and structure of the availability data input."Invalid availability type in entry X. Must be 'SCHEDULE' or 'EXCEPTION'."
Correct thetypefield in the specified entry."Missing day_of_week in SCHEDULE availability entry X."
Add a validday_of_weekfield for that entry."Invalid time format in entry X. Use 'HH:MM' format."
Fix the time strings to match the required format."Staff ID ... does not exist."
Verify the staff ID exists in the Neo4j database before running the node."Failed to establish Neo4j connection."
Check network connectivity and credential correctness.