How do I filter resources or options in booking forms?

Modified on Thu, 4 Dec at 11:33 AM

How do I filter resources or options in booking forms?

Sometimes you don’t want all resources to be bookable on every form. You might need to show only specific users, limit by region, or control which resource is preferred.

On this page

Jump to any section using the links below

Sometimes you don’t want all resources to be bookable on every form. You might need to show only specific users, limit by region, or control which resource is preferred. This article explains how to filter and prioritize resources in booking forms, including dynamic JavaScript control.


1. Static resource selection in the booking form

Each booking form has a Resources / Who configuration:

  • Choose which calendar resources are allowed for this form.

  • Decide if customers can select the resource, or if Hubhus should pick automatically.

  • Optionally book the assigned person on the lead, if they are bookable at the location.

This is the primary, static way to restrict bookable resources.


2. Filtering resources using tags (conceptual)

If you use resource tags and user tags in your calendar setup:

  • Tags can represent regions, teams, skills, vehicles, etc.

  • Booking forms can use pre-selected resource sets that already reflect these tags (e.g. “Region West team”).

A common pattern:

  • Maintain tag-based rules at calendar level.

  • Create dedicated booking forms per combination (e.g. region or service type) rather than one form that tries to do everything.

This keeps configuration easy to understand and avoids overly complex logic in each form.


3. Location-based filtering (postal codes and transit)

In the booking form’s Location & transport section you can control which resources are allowed based on address and travel time:

  • Bookable in postal codes

    • Use the resource’s own operable postal codes, or

    • Define other constraints.

  • Max. driving from base

  • Max. driving in between events

  • Max. driving before/after business hours

These rules, together with each resource’s base address and operable postal codes, determine:

  • Which resources are eligible for a given address

  • Which time slots are allowed or rejected

When combined with Highlighted times, the system will also prioritize resources with the best transits.


4. Dynamic resource filtering with JavaScript

For advanced scenarios (e.g. embedding the form on different partner sites or prefiltering by external logic) you can override the bookable resources via JavaScript.

4.1 Setting the bookable resources

Place JavaScript somewhere early in the booking form (typically in Part 1 or in the form’s JavaScript field under the Styling button):

<script> var resources = [ { "id": 534, "weight": 30 }, { "id": 552, "weight": 0 } ]; bookingForm.setCalendarResources(resources); </script>

Notes:

  • Each object must at least contain an id (calendar resource ID).

  • You can optionally add weight (see below).

  • The specified IDs must be a subset of the resources already selected in the booking form.

You can also pass only IDs:

<script> bookingForm.setCalendarResources([534, 552]); </script>

4.2 Using URL parameters to define resources

Instead of JavaScript, you can also specify resources via a URL parameter:

https://your-form-url?calendar_resources=534,552

The parameter calendar_resources must contain a comma-separated list of resource IDs. This is useful when:

  • Different partners each get a link that only shows their resources.

  • You build landing pages that preselect a subset of team members.


5. Understanding weights and prioritization

When multiple resources are available at the same time, Hubhus uses a total weight calculation to decide who is preferred:

totalWeight = resourceWeight - transitMinutes
  • resourceWeight – the weight you define in JavaScript ("weight": 30) or via helper functions.

  • transitMinutes – the calculated travel time for that slot.

A higher resource weight makes that resource more likely to be chosen, even if transit is slightly longer.

You can also modify weight individually:

<script> // Get current resources and adjust weight for the first one var r = bookingForm.getCalendarResources(); r[0].weight = 30; bookingForm.setCalendarResources(r); </script>

6. Inspecting and debugging resource selection

Two placeholders can help you debug which resources are currently in play:

  • All calendar resources (static)

    • %calendar_resources_as_pretty_json%

    • Shows the full definition of available resources and their IDs.

  • Current bookable resources (after JS/URL filters)

    • %booking_bookable_resources_as_pretty_json%

    • Shows the resources and weights used by the search algorithm.

Place %booking_bookable_resources_as_pretty_json% in Part 3 (confirmation) or at the bottom of Part 2 (under the time suggestions) while testing, then remove it before going live.


7. Form messages for filtered/blocked bookings

When filtering is based on location or transit, make sure to update your Form messages so customers understand why a booking is blocked:

  • Unsupported postal code

  • Address too far away

  • No available times found in the allowed date window

Clear explanations reduce confusion and support tickets.


Best practices

  • Use static selection and calendar tags for the bulk of your segmentation.

  • Use JavaScript and calendar_resources URL parameters only for advanced, well-documented cases.

  • Always test:

    • One address inside the allowed area

    • One address outside

    • Multiple dates and durations

  • During testing, include %booking_bookable_resources_as_pretty_json% to verify that your filters and weights are behaving as intended.

? Common searches

booking setup • calendar setup • appointment scheduling • booking configuration

? Also known as

appointment • scheduling • reservation • calendar event

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article