Overview
The Block Resource action creates a resource block (user event) that prevents a resource from being available during a specific time period. This is useful for blocking out maintenance windows, personal time, or any period when a resource should not be bookable. The action can optionally sync the block to the resource's Google Calendar.
Configuration
Resource ID (Required)
The ID of the resource to block. The resource must belong to the same business unit as the workflow and must have an attached user. Supports variables.
Example:
{resource.id}or
123
Summary (Required)
A brief description of why the resource is blocked. This will be displayed in the calendar and used as the event title if synced to Google Calendar. Supports variables.
Example:
Maintenance Window
or
{booking.summary} - Personal TimeStart Date/Time (Required)
The start date and time for the block. Accepts ISO8601 format (e.g., 2024-01-15T10:00:00Z) or other common date formats. The date will be automatically converted to UTC. Supports variables.
Example:
{availability.start}or
2024-01-15T10:00:00Z
or
2024-01-15 10:00:00
End Date/Time (Required)
The end date and time for the block. Must be after the start date/time. Accepts ISO8601 format or other common date formats. The date will be automatically converted to UTC. Supports variables.
Example:
{availability.end}or
2024-01-15T14:00:00Z
Schedules (Optional)
Comma-separated list of schedule IDs (product option IDs) to block. If provided, a separate block will be created for each schedule. If not provided, the block applies to all schedules for the resource. Supports variables.
Example:
1,2,3
or
{schedule.id}Sync to Google Calendar (Optional)
Whether to sync this block to the resource's Google Calendar. Defaults to false if not provided. When set to true, the block will be created as an event in the resource's connected Google Calendar. The event will be marked as "busy" and linked back to the block via metadata. Supports variables.
Example:
true
or
false
Output
Returns the created user event (resource block) in the workflow context:
id- User event IDuser_id- ID of the user who owns the resourceevent_id- Event ID (alwaysblocked_datesfor blocks)summary- Summary textstart- Start date and time (ISO8601 format)end- End date and time (ISO8601 format)bookable_type- Type of bookable (if block is for a specific schedule)bookable_id- ID of the bookable (if block is for a specific schedule)calendar_id- Google Calendar ID (if synced)created_at- Creation timestampupdated_at- Last update timestamp
Accessing Block Data
After this action, you can access:
{user_event.id}
{user_event.user_id}
{user_event.summary}
{user_event.start}
{user_event.end}
{user_event.bookable_type}
{user_event.bookable_id}Note: If multiple schedules are provided, only the first created block is returned in the context. All blocks are created successfully, but subsequent workflow steps will only have access to the first one.
Examples
1. Basic Block
Resource ID: {resource.id}
Summary: Maintenance Window
Start: 2024-01-15T10:00:00Z
End: 2024-01-15T14:00:00ZCreates a 4-hour maintenance block for the resource.
2. Block with Google Calendar Sync
Resource ID: {resource.id}
Summary: Personal Time
Start: {availability.start}
End: {availability.end}
Sync to Google Calendar: trueCreates a block synced to Google Calendar using dates from the workflow context.
3. Block for Specific Schedules
Resource ID: {resource.id}
Summary: Schedule Maintenance
Start: 2024-01-15T09:00:00Z
End: 2024-01-15T17:00:00Z
Schedules: 1,2,3Creates separate blocks for schedules with IDs 1, 2, and 3.
4. Block from Booking Context
Resource ID: {booking.resources[0].id}
Summary: Blocked after {booking.id}
Start: {booking.end}
End: {booking.end} + 2 hours
Sync to Google Calendar: trueCreates a block starting immediately after a booking ends, synced to Google Calendar.
Google Calendar Integration
When sync_to_google_calendar is set to true:
A
UserEventCreatedevent is dispatchedThe
GoogleCalendarSubscriberlistens to this eventA
CreateUserEventInCalendarJobis queued to create the event in Google CalendarThe Google Calendar event is created with:
Summary from the block
Start and end times matching the block
Status set to "busy" (locked)
Description from the block (if provided)
Metadata linking back to the UserEvent ID
The Google Calendar event will have metadata (userEventId) that links it back to the original block. This allows the system to properly clean up the calendar event when the block is removed.
Requirements:
The resource must have an attached user
The user must have Google Calendar connected (
gcal_access_tokenmust be set)If Google Calendar is not connected, the block is still created but not synced
Validation
The action validates:
Resource ID is required and not empty
Resource exists and belongs to the same business unit as the workflow
Resource has an attached user
Summary is required and not empty
Start date/time is required and can be parsed
End date/time is required and can be parsed
End date must be after start date
Schedule IDs (if provided) must exist as product options
sync_to_google_calendarmust be a boolean value if provided
If any validation fails, an InvalidArgumentException is thrown.
Best Practices
Use variables - Leverage workflow context variables for dynamic dates and resource IDs
Set appropriate summaries - Use descriptive summaries that explain why the resource is blocked
Consider schedules - Use the schedules field to block specific product options rather than all schedules
Sync to Google Calendar - Enable Google Calendar sync to keep external calendars in sync
Handle timezones - Dates are automatically converted to UTC, but be aware of timezone differences
Validate dates - Ensure end date is after start date to avoid errors
Check resource availability - Consider checking if the resource is already blocked before creating a new block
Use in workflows - Combine with Find Resource Blocks to check for existing blocks before creating new ones
