Scheduler per day stats

Scheduler per day stats

The scheduler can show a summary under each day in the column header:

The feature is off by default. It turns on when the shift schedulable carries a dayStats key.

How the numbers are calculated

Stats are recalculated every time the scheduler applies filters: on load, after a background data refresh, after a shift is created, edited, moved or deleted, and whenever a user changes a filter. They count only visible shifts, so they always agree with what the user sees on the grid and with the per resource stats under each resource name.

Each shift is counted on the calendar day it starts, in the timezone the scheduler displays it in. An overnight shift counts on its first day.

Coverage

Shift Counts towards total Counts as assigned
Matches excludeIf No No
Assigned to a worker (not in the unassigned lane, contactFieldPath populated) Yes Yes, unless it matches unassignedIf
Unassigned (open) shift Yes No
Shift demand requiring N staff N minus the demand's assigned child shifts No (the assigned children count)
Demand child shift that is assigned Yes Yes
Demand child shift that matches unassignedIf or has no worker No (the parent demand still holds that seat open) No

So a demand for 3 staff with one assigned child counts as 1/3, and when a worker cancels a demand child the seat goes back to the demand without being counted twice.

Items

Items count positions the same way coverage does, so a status breakdown adds up to the coverage total:

For sum, a demand's value is multiplied by its open seats. Use an item's own condition to narrow it.

aggregate Needs Shows
countBy fieldPath One badge per distinct value with its count. Picklist values show their label from the Salesforce describe, in the running user's Salesforce language (the app language switch does not change it). Blank values show as "None".
sum fieldPath (numeric) label: total, rounded to one decimal place
count nothing label: number of shifts

Every item accepts an optional condition in the standard condition format (allOrSome + selectors).

Configuration

Add dayStats to schedulables.shift in the scheduling context provider JSON (b3s__Scheduling_Context_Provider__mdt.b3s__JSON__c).

The example below uses only fields that ship with the package. b3s__Status__c on b3s__Shift__c has the values New, Confirmed, Cancelled and Requested Swap. Here Cancelled and Requested Swap shifts still need covering, so they count as open slots, and the header also shows a badge per status.

"dayStats": {
    "unassignedIf": {
        "condition": {
            "allOrSome": "some",
            "selectors": [
                { "field": "b3s__Status__c", "operator": "in", "value": ["Requested Swap", "Cancelled"] }
            ]
        }
    },
    "items": [
        { "label": "Status", "fieldPath": "b3s__Status__c", "aggregate": "countBy" }
    ]
}

With 6 shifts on a day (4 Confirmed, 1 Requested Swap, 1 open New) plus a demand for 3 staff with one assigned child, the header reads 5/9 with the badges Confirmed 5, Requested Swap 1, New 3. New 3 is the open shift plus the demand's two open seats (the demand's own status is New), and the assigned child is one of the five Confirmed. The badges add up to the coverage total.

More item examples

Use these when your org has the fields involved. fieldPath and selector field must be API names that exist on the shift object (or relationship paths from it), otherwise the scheduler fails to load.

"excludeIf": {
    "condition": {
        "allOrSome": "some",
        "selectors": [{ "field": "b3s__Status__c", "operator": "equals", "value": "Cancelled" }]
    }
},
"items": [
    { "label": "Required staff", "fieldPath": "b3s__Required_Staff__c", "aggregate": "sum" },
    {
        "label": "Swaps",
        "aggregate": "count",
        "condition": {
            "allOrSome": "all",
            "selectors": [{ "field": "b3s__Status__c", "operator": "equals", "value": "Requested Swap" }]
        }
    },
    {
        "label": "Broadcasting",
        "aggregate": "count",
        "condition": {
            "allOrSome": "all",
            "selectors": [
                { "field": "b3s__Invitations__c", "operator": "greaterthan", "value": 0 },
                { "field": "b3s__Contact__c", "operator": "isnull", "value": true }
            ]
        }
    }
]

"Broadcasting" counts open shifts and demands that have at least one invitation. b3s__Invitations__c is a roll-up count of every invitation on the shift, including Rejected and Revoked ones, so a shift whose invitations were all declined still counts. The count refreshes when shift data reloads; it does not update the moment a worker responds.

Use excludeIf instead of unassignedIf for a status that means the shift is no longer needed, so it drops out of coverage entirely.

Key Required Description
excludeIf No Shifts matching this condition are left out of coverage entirely. Typical use: a status that means the shift is no longer needed, such as Cancelled when cancellations are not refilled.
unassignedIf No Shifts matching this condition still need covering, so they count as open slots even if a worker is linked. Typical use: Requested Swap, or Cancelled when cancelled shifts must be refilled.
items No Ordered list of extra stats. Each item has label, aggregate, and optionally fieldPath and condition.

Field names used in fieldPath and in selector field keys are added to the shift query automatically. You do not need to list them elsewhere.

Coverage relies on contactFieldPath, and for demands on demandRequiredStaffFieldPath and demandParentFieldPath, all set on the same shift schedulable.

Where stats appear

Under each worker's name, the resource timeline shows the visible shift count and scheduled hours. Actual hours appear when the total is greater than zero. To translate the row, use resourceStats.shifts with one and other forms and %{count}. Use resourceStats.scheduled and resourceStats.actual with %{hours}. Include the unit in the translation, for example %{hours}h scheduled. App translations

Troubleshooting