Filters let scheduler users hide and show shifts, requests and workers directly in the calendar. You define filters as Custom Metadata records, so no code deployment is needed, and every filter is a small JavaScript object you control.
There are two flavors:
Both live in the filters side panel, participate in the Filter Logic expression, and appear as numbered summary pills in the header when active.
The calendar remains interactive while the filters panel is open. Scroll over the exposed calendar to move through scheduler rows; scroll inside the filters panel to browse its controls. No Salesforce configuration changes are required for this behavior.
Create records of b3s__Scheduling_Filter__mdt under Setup, Custom Metadata Types, Scheduling Filter, Manage Records.
| Field | Purpose |
|---|---|
Label / DeveloperName |
Admin facing name of the record (not shown to users). |
b3s__Javascript_Code__c |
A single JavaScript object literal that defines the filter (see below). |
b3s__Order__c |
Sort order in the filters panel, ascending. The shipped filters use 1 to 10. |
Every Scheduling Filter record in the org loads when the scheduler boots. There is no per app or per group assignment. To remove a filter, delete the record or do not deploy it. Ready made examples are included as sample b3s__Scheduling_Filter records with the package.
b3s__Javascript_Code__c holds one JavaScript object literal:
{
name: "shift-status", // unique across all filters
label: "Shift Status", // heading shown in the panel
type: 'shift', // 'shift' | 'request' | 'resource'
isDefaultOpen: true, // optional: panel section starts expanded
// EITHER items() ........... standard checkbox filter
// OR inputs: [...] ...... advanced filter
matchesItems: function (object, items) {
// return true -> keep the object visible
// return false -> hide it
}
}
type property, what the filter hides'resource' evaluates against worker rows. Hiding a worker also hides all of their events and removes the row entirely.'shift' or 'request' evaluate against calendar events. Either value is evaluated against all events (both shifts and requests). The value mainly drives the shows and hides counters on the header pills. If your filter should only affect one kind, check event.title (it is 'shift' or 'request') inside matchesItems and return true for the other kind.A filter never applies across categories. While evaluating a worker row, any active shift filters count as pass, and the other way round, so they stay neutral in the filter logic expression.
matchesItems receivesThe first argument is a calendar object:
event.extendedProps.record is the Salesforce record (with the fields your loaders and context provider fetch), event.start and event.end are Dates, event.title is 'shift' or 'request'.resource.extendedProps.record is the Contact record and resource.id is the row id. The Unassigned swimlane has no record, so return true when record?.Id is missing to keep it visible.The second argument is the current selection:
names.items[0] is an object with the user's input values keyed by input name.The snippet is evaluated inside the scheduler with these in scope:
| Variable | Contents |
|---|---|
events |
All loaded calendar events (unfiltered). |
screenEvents |
Events currently visible (after filters). |
resources |
All worker rows, including currently hidden ones. |
screenReources |
Worker rows currently visible (note the spelling). |
viewName |
Current calendar view type. |
Filters re-evaluate whenever data reloads, so items() can derive its options from events and stay current. Keep the code fast: it runs against every event on every filter run, and large datasets are processed in chunks with a progress bar.
Declare items() returning the checkbox list:
{
name: "shift-status",
label: "Shift Status",
type: 'shift',
isDefaultOpen: true,
items: function () {
// Distinct statuses from the loaded events
const statuses = [...new Set(
events.map(e => e.extendedProps?.record?.b3s__Status__c).filter(Boolean)
)];
return statuses.map(s => ({ name: s, label: s }));
},
matchesItems: function (event, selected = []) {
return selected.includes(event.extendedProps?.record?.b3s__Status__c);
}
}
Item properties: name (the value passed back in selected), label, optional color (checkbox border color) or classes (extra CSS classes, including configured colour classes such as bg-emerald-200). Items render in the order returned. A search box appears automatically when a filter has more than 5 items. Checking or unchecking applies immediately, and matchesItems is only called while at least one item is selected.
Declare inputs instead of items. The panel renders the inputs plus Execute and Clear buttons, and nothing applies until Execute is clicked. On Execute all values are collected into one object and handed to matchesItems as items[0].
{
name: "resource_distance",
label: "Workers by Distance",
type: 'resource',
inputs: [
{ name: "address", type: "address", label: "Address",
placeholder: "Search address..", required: true },
{ name: "distance", type: "select", label: "Within", default: "5",
options: [
{ label: "1 km", value: "1" },
{ label: "5 km", value: "5" },
{ label: "10 km", value: "10" }
] }
],
matchesItems: function (resource, items) {
const values = items[0] ?? {}; // { address: {label,lat,lng}, distance: "5" }
const record = resource.extendedProps?.record;
if (!record?.Id) return true; // keep the Unassigned lane
// ... distance calculation, return true/false
}
}
type |
Renders | Value received in matchesItems |
|---|---|---|
text |
text box | string |
select |
dropdown (needs options) |
the option value (always a string, Number(...) it if numeric) |
multiselect |
checkbox list (needs options) |
array of option values |
range |
slider | with options: the selected option's value; otherwise a number, configured via min / max / step / unit |
date |
native date picker | "YYYY-MM-DD" string |
time |
native time picker | "HH:MM" string |
address |
Google address search | { label, lat, lng }, coordinates only exist when the user picked a suggestion |
Common input properties: name, type, label, required, placeholder, default, options ([{ label, value }]).
Behavior notes:
required inputs are validated on Execute, and empty ones show an inline error. An address input must be picked from the suggestions, because typed text alone carries no coordinates and counts as empty.day input in the shipped Resource_Availability filter, which defaults the date picker to today.Label: value pairs.address inputsAddress search uses Google Places and needs an API key:
b3s__Scheduler__c), Manage.b3s__Google_Maps_API_Key__c) at org level, with the Places API enabled on the key.Without the key, filters containing an address input show a warning and cannot be executed. All other input types need no setup.
Each active filter gets a number badge (1, 2, 3) in activation order. By default all active filters are AND-ed together. Users can enter a custom expression in the Filter Logic box at the top of the panel:
1 AND (2 OR 3)
Rules, same style as Salesforce report filter logic:
AND, OR and parentheses (case insensitive).Filters of the other category (resource versus event) evaluate as true inside the expression for that target, so mixed logic like 1 AND (2 OR 3) works even when 1 is a worker filter and 2 to 3 are shift filters.
Included in the Version 11 configuration downloads, deploy what you need. Version 11 sample DeveloperNames use a WFM_ prefix before the names shown below:
| Filter | Record | Kind | What it does |
|---|---|---|---|
| Shift Status | Shift_Status_Filter |
checkbox | One checkbox per distinct b3s__Status__c in the loaded shifts. |
| Job / Site / Job Group | Shift_Job_Filter, Shift_Site_Filter, Shift_Job_Group_Filter |
checkbox | Filter shifts by their job, site or job group. |
| Workers | Resource_Filter |
checkbox | Filter the worker rows by name. |
| Workers by Distance | Resource_Distance_Filter |
advanced | Address plus radius dropdown (1 to 15 km), keeps workers whose Contact MailingLatitude / MailingLongitude is in range. |
| Shifts by Distance | Shift_Distance_Filter |
advanced | Address plus distance slider, keeps shifts whose work site location is in range. |
| Available After / Before Time | Resource_Available_After, Resource_Available_Before |
advanced | Time input, keeps workers with no shift and no Unavailable request overlapping the rest of the day after (or before) that time. |
| Worker Availability | Resource_Availability |
advanced | Day (date picker, defaults to today), period (Morning / Day / Night / Full day) and Show mode. Not marked unavailable keeps workers with no shift and no Unavailable request in that window; Confirmed available only additionally requires an Available request overlapping the window. Built for fast same-day filling: hide everyone who can't work the selected day. |
| Time and Attendance | Shift_Attendance_Filter |
checkbox | Keeps shifts with the ticked attendance issue (see below). Ticking several keeps shifts with any of them. |
| Clock / Check-in Distance | Shift_Attendance_Distance_Filter |
advanced | Pick Clock in, Clock out and/or Check in plus a distance (500 m to 10 km), keeps shifts where any picked location is further than that from the work site. |
Data prerequisites:
MailingLatitude and MailingLongitude in fieldToLoad (the shipped contact loaders already do).additionalFields: b3s__Work_Site__r.b3s__Location__Latitude__s and ...__Longitude__s (present in the shipped providers).b3s__Type__c = "Unavailable" (or "Available" for the Worker Availability confirmed mode). All-day events with no end count as one day. Pick a day inside the loaded range: requests and shifts outside it are not loaded, so availability results outside that range are not reliable.b3s__Check_In_Required__c, b3s__Check_In_Time__c, b3s__Check_In_Distance__c, b3s__Clock_In_Distance__c and b3s__Clock_Out_Distance__c in additionalFields (present in the shipped providers). Distances need the Work Site b3s__Location__c, see Time and attendance dashboards.Only assigned, non-cancelled shifts with a scheduled start are considered. Review these thresholds alongside the attendance reports. They are configured independently, including different check-in windows; to change a filter threshold, edit the numbers in the record's rules.
| Option | Keeps shifts that |
|---|---|
| Not checked in, starts within 60 / 120 min | Require check-in (b3s__Check_In_Required__c), have no check-in or clock-in, and start within the next 60 or 120 minutes |
| At risk of lateness | Start within the next 60 minutes, are not clocked in, and either still need a check-in or were checked in more than 5 km from the site |
| Late clock-in | Were clocked in more than 5 minutes after the scheduled start |
| No show | Have no clock-in more than 15 minutes after the scheduled start |
| Early clock-in | Were clocked in more than 30 minutes before the scheduled start |
| Early clock-out | Were clocked out more than 5 minutes before the scheduled end |
| Late clock-out | Were clocked out more than 15 minutes after the scheduled end |
| Not clocked out after end | Are clocked in, not clocked out, and the scheduled end has passed |
The time based options compare with the current time when filters run, which is on load, background sync, save and view change. A shift crosses into a band at the next sync, not the exact minute.
These are shift filters: they hide shifts, not workers, so rows without a matching shift stay visible but empty.
filterRecordsBy clauses or an Apex filter plugin. See Apex filters.undefined on the record.matchesItems cheap. It runs once per event or worker per filter run. Precompute lookups in the snippet body (which runs once per data load) rather than inside matchesItems.