Shift templates

Shift templates

Shift templates let scheduling users capture a set of shifts as a reusable pattern (for example "Mon-Fri 7-14, at Acme Ltd") and later re-create that pattern starting from any date on the calendar. Templates capture the job, site, location, times and other configured fields - never the person. They are stored per scheduling context, so templates created while scheduling Acme Ltd are only offered when that same context is loaded.

How it works

Creating a template

  1. Select one or more shifts on the scheduler (Ctrl/Cmd + click or lasso).
  2. Right click and choose Templates → Add to Template.
  3. Review the visual preview of the captured pattern, give the template a name and save.

Rules that apply when capturing:

The pattern is stored relative to its earliest day. A Monday-to-Friday selection becomes day offsets 0 to 4; the actual calendar dates are discarded. Times are stored as wall-clock values in each shift's site timezone, so a 07:00 start stays a 07:00 start when the pattern is inserted across a daylight-saving change.

Inserting a template

  1. Right click an empty cell (or a shift/request) on the row where the pattern should start.
  2. Choose Templates → Insert Template.
  3. Search by template name. Each row renders the template's pattern: the first column is the clicked date, each following column is the next day, and each box is a would-be shift showing its times and title fields.
  4. Click Insert.

The first day of the pattern lands on the clicked date; the remaining shifts follow their stored day offsets. The shifts are created through the scheduler's normal save pipeline, so they appear immediately and show a save error on the tile if the server rejects them.

Rules that apply when inserting:

Managing templates

Templates → Manage Templates (also available from the template icon in the scheduler's right sidebar) lists the current context's templates with their pattern previews. Users can rename and delete templates there, subject to their Edit and Delete permissions on the Scheduling Template object.

If a record referenced by a template (for example a Site or Job) has been deleted since capture, inserting the template fails with a save error on the created tiles. Decide whether to correct the data or delete the template from the manager.

The Scheduling Template object

Templates are rows of the packaged custom object Scheduling Template (b3s__Scheduling_Template__c):

Field Purpose
Name The template name users search by
b3s__Template_Data__c Long text area (131,072 chars) holding the pattern as JSON. Managed by the scheduler UI - do not hand-edit
b3s__Context_Id__c The scheduler context record Id the template was created under
b3s__Definition_Key__c The scheduler definition key the template was created under

Both context fields are used when listing templates, which is what scopes templates to the loaded context (a specific Account, Group, Site and so on). All access is enforced with the running user's CRUD permissions - grant the object and its fields on a permission set (the packaged WFM Admin permission set includes full access). Users without Read access on the object simply never see the Templates menu.

Configuration

Templates are enabled per scheduling definition by adding a templateRetentionFields array to the shift schedulable in the Scheduling Context Provider JSON. Without it, no Templates menu appears. The default shipped configuration:

"templateRetentionFields":[
    {"field":"b3s__Scheduled_Start_Time__c","useContextDate":true},
    {"field":"b3s__Scheduled_End_Time__c","useContextDate":true},
    {"field":"b3s__Required_Staff__c","default":"1","showIf":{"condition":{"allOrSome":"all","selectors":[{"field":"b3s__Contact__c","operator":"isnull","value":true}]}}},
    {"field":"b3s__Work_Job__c"},
    {"field":"b3s__Work_Site__c"},
    {"field":"b3s__Work_Site_Location__c"},
    {"field":"b3s__Status__c"},
    {"field":"b3s__Comments__c"},
    {"field":"b3s__Internal_Comments__c"}
]

Entry options:

Key Meaning
field Shift field API name to retain (also accepted as fieldName)
useContextDate For datetime fields: keep the wall-clock time and day offset, recalculate the date from the insertion cell. Fields without this flag are copied verbatim
default Value applied at insert time when the template holds no value for the field. Numeric fields are coerced automatically. The token :contextId resolves to the loaded context record Id
showIf Standard selector condition evaluated against the record being created. When it fails, the field is dropped - the shipped config uses this so Required Staff only applies on the unassigned (demand) lane

The preview boxes are titled with the shift schedulable's shiftBulkViewTitle field configuration (falling back to the view's shiftTitle), so the same Job/Site labels used elsewhere in the scheduler appear in template previews.

Notes for integrators