The Shift Importer is an internal, AI assisted tool that turns an unstructured schedule (a spreadsheet, image, PDF, or pasted email) into WFM shift records (b3s__Shift__c) without manual re-keying. A user uploads or pastes the source, a configurable AI provider extracts structured records against a template you define, the user reviews and corrects the result in an editable grid, and only then are the records bulk saved. Nothing is written to your org automatically.
Agencies and scheduling teams receive rosters in whatever format the client or site happens to send: a spreadsheet with idiosyncratic column headers, a photographed whiteboard, a PDF timetable, or the body of an email. Historically these are re-typed into the scheduler by hand, which is slow and error prone. The Shift Importer removes the keying step: you describe once (in a reusable template) what the target shift fields are and how to interpret the source, and the AI maps each incoming roster onto those fields. The human stays in control of the final commit.
Internal, authenticated back office users (schedulers, coordinators, a dedicated "Record Importer" user). It is not a portal app. Every server call runs as the signed in user, so object and field security apply: a user who lacks create access on b3s__Shift__c cannot import even if the page renders for them. See the access model in Apex API reference.
b3s__Shift__c. This is a shift importer specifically, not a generic object loader. Imported shifts flow straight into the scheduler and every downstream app that reads shifts.A five step wizard. The user can move back and forth; expensive AI extraction is cached so revisiting a step does not re-run (or re-pay for) it.
b3s__Group__c), then pick or create an import template. At least one of the two is required. Only the Account's own templates and global templates are offered (see Template availability by account). The Account and the Group scope the reference (lookup) queries in step 5 through the {accountId} and {groupId} merge tokens, so the AI's suggested values resolve against the right records. The group list shows the groups the picked Account is assigned to (b3s__Group_Assignment__c rows with that Account), or every group when it has none or no Account is picked. When the Account is assigned to exactly one Group, that Group is selected automatically..xlsx, .xls, .csv), image (.png, .jpg, .gif, .webp) or PDF, or paste a formatted table or email. The importer keeps table content and supported images, strips active content and cleans the paste again if you return to this step. The review grid displays extracted values and validation messages as text. Workbooks with several sheetsWhen an uploaded Excel workbook has more than one sheet that holds data, the Add data step lists the sheets under Sheets to import, each with a checkbox.
| Behaviour | Detail |
|---|---|
| Default selection | Every visible sheet is ticked. Hidden sheets are listed with a Hidden badge and start unticked, because they usually hold helper data or an old copy of another sheet. |
| Empty sheets | Not listed and never sent. |
| Processing | Each ticked sheet is treated as its own source: it gets its own preview in step 3, its own AI run in step 4 (generalist plus every auditor) and its own source viewer in step 5. Sheets are processed one after another. |
| Sheet name | The sheet name is passed to the AI with the sheet's content, so a template prompt can rely on it (for example a weekday or a date that only appears in the tab name). |
| Review grid | A Source File column shows <file name> › <sheet name> for every row. |
| Import run | The workbook is stored once on the import run. The AI output is stored per sheet. |
| Cost | AI usage scales with the number of ticked sheets. Untick sheets that hold no shifts, such as lookup lists and summaries. |
A workbook with a single sheet that holds data, and every CSV file, behaves as before with no picker. A sheet cannot read another sheet: if a schedule sheet depends on a lookup sheet (for example staff codes), put the lookup into the template prompt or the reference lookups instead. After leaving the Add data step only the ticked sheets are kept; add the file again to pick a sheet that was left out.
The AI attaches a confidence score to each extracted record. In the review grid this is colour coded so a reviewer's eye is drawn to the weakest rows first:
| Confidence | Badge | Meaning |
|---|---|---|
| Above 0.9 | Green | High confidence, usually safe to accept. |
| 0.6 to 0.9 | Yellow | Check the row before importing. |
| Below 0.6 | Red (row tinted) | Low confidence, likely needs correction. |
For spreadsheet sources (CSV and Excel), clicking a row's confidence badge opens the source viewer: the sheet the row came from, with the cells the AI read for that row highlighted. The viewer also shows how much of the sheet the whole extraction used:
| Cell | Meaning |
|---|---|
| Strong highlight | Read for the row that was clicked. |
| Soft green tint | Read for at least one other row from the same sheet. |
| Plain | Not read for any row. |
Plain cells that hold data are either content the template skips on purpose (titles, totals, summary blocks, workers the prompt excludes) or content the AI missed. Scanning the viewer for an untinted worker or shift line is the quickest way to spot a missed row. Ignored rows still count as used. The spreadsheet viewer is not available for PDFs or runs resumed from Past imports, which carry no source preview. Images have their own view, described below.
An image (PNG, JPG, GIF or WEBP) is normalised in the browser before it is sent to the AI:
If the browser cannot process the image, it is sent exactly as uploaded and the import continues.
When the template's extraction (generalist) model is a Gemini model, the AI also returns, for every row, the area of the image the row was read from. Clicking the row's confidence badge opens the source viewer with the image and an outline around that area. The location is approximate: the outline is drawn slightly larger than the area the AI reported, and it marks the whole line or block for the row, not individual values. Use it to find the row on the image, then check the values by eye.
| Source | Extraction model | Source location |
|---|---|---|
| Image | Gemini | Outline on the image, one per row. |
| Image | OpenAI or DeepSeek | None. The confidence badge does not open the viewer. |
| Any | None. PDFs are sent exactly as uploaded. |
Auditors keep the location the generalist reported, whatever provider they run on, unless they change which part of the image a row comes from. The import run always stores the original uploaded file, not the normalised copy.
Extraction is not a single call. Each template defines:
Every agent declares its own provider and model, so you can, for example, extract with a fast, inexpensive model and then have a stronger model audit the result. The source file is sent to every agent (generalist and each auditor), so auditors always compare against the original rather than a lossy summary. The completed pipeline result is cached for 24 hours, keyed on the exact template plus the exact source file, so navigating away and back does not trigger a re-run.
Structured output is forced with a schema built from the template's field mappings, so the model must return records shaped exactly like your target fields plus two internal markers (a confidence score and a provenance reference back to the source rows or cells).
Any number of files can be added in one go, for example a folder of timesheet photos. Each file is its own extraction, and its records carry the file name so the review step can show the right source.
Things to know:
A model can read a very large sheet, but one response can only hold so many records. The importer therefore processes large sheets in parts automatically and joins the results into one review grid.
Things to know:
The importer works with a configurable AI provider that you connect with your own API key and model. You are not tied to a single vendor, and you can mix providers across agents in one run.
Supported providers are Google Gemini, OpenAI and DeepSeek. Populate the key for whichever provider(s) you intend to use; a provider with no key cannot be picked at run time (the agent fails with "No API key is configured for ...").
The connection is configured once at org level on the b3s__Scheduler__c hierarchy Custom Setting (org defaults), read by the host page and handed to the app:
| Setting | Purpose |
|---|---|
b3s__Gemini_AI_Key__c |
Google Gemini API key. |
b3s__OpenAI_Key__c |
OpenAI API key. |
b3s__DeepSeek_Key__c |
DeepSeek API key. |
b3s__X3B_AI_Endpoint__c |
The 3B AI endpoint that AI requests are sent through. |
Two important points for integrators:
| Tier | When to use it |
|---|---|
| Flagship | Most capable, best for messy or complex sources, costs more. |
| Balanced | Good quality at a fair price, a sensible default. |
| Fast and cheap | Quick and inexpensive, good for clean, simple tables. |
| Deep reasoning | Thinks longer before answering, slower and pricier. |
| Older | Previous generations, prefer a newer model unless you have a reason. |
The models offered in every picker (extraction, checkers, quick start, smart matching) come from the b3s__AI_Model__mdt Custom Metadata Type, so a new or retired model is a metadata change, not an app release. 3B ships and maintains the packaged rows; a package upgrade updates their prices, tiers and notes and deactivates retired models. To offer a model that is not listed yet, add your own row in Setup (Custom Metadata Types, AI Model, Manage Records).
| Field | Meaning |
|---|---|
| Label | Name shown in the picker. |
b3s__Provider__c |
gemini, openai or deepseek. |
b3s__Model_Id__c |
Exact API model id, for example gemini-3.6-flash. |
b3s__Tier__c |
Flagship, Balanced, Fast & cheap, Deep reasoning or Older. |
b3s__Input_Cost_Per_Million__c, b3s__Output_Cost_Per_Million__c |
USD list price per 1M tokens, shown in the picker. Blank = not shown. |
b3s__Context_Tokens__c |
Context size, shown in the picker. |
b3s__Output_Tokens__c |
Most tokens the model may return per call (extraction, matching and template suggestions). Blank = the provider default: Gemini 32K, DeepSeek 64K, OpenAI the model's own maximum. Keep it at or below the model's documented limit, or the provider rejects the call. |
b3s__Note__c |
Short caveat shown in the picker, for example text only, no images or PDFs. |
b3s__Default_For__c |
Extraction: model for new templates and for templates saved without a model. Matching: default smart matching model. Use each value on one row. |
b3s__Sort_Order__c |
Order inside a tier, lower first. |
b3s__Active__c |
Unticked rows are hidden from the pickers. |
Packaged rows are maintained by 3B, so their fields cannot be edited in your org; to change a default, add your own row. If no row is marked as a default, Gemini 3.6 Flash (extraction) and Gemini 3.1 Flash-Lite (matching) are used. The packaged catalog (reviewed November 2026) is:
| Provider | Models |
|---|---|
| Google Gemini | Gemini 4 Argon, Gemini 3.1 Pro (preview), Gemini 3.8 Flash, Gemini 3.6 Flash (Extraction default), Gemini 3 Flash (preview), Gemini 3.5 Flash-Lite, Gemini 3.1 Flash-Lite (Matching default), Gemini 2.5 Flash-Lite (Older) |
| OpenAI | GPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra, GPT-6 Luna, plus GPT-5.4, GPT-5.4 mini, GPT-5.1, GPT-4.1, GPT-4.1 mini, GPT-4o, GPT-4o mini (Older) |
| DeepSeek | DeepSeek V4 Pro, DeepSeek Flash |
A template that names a model no longer in the catalog keeps that value and runs until the provider shuts the model down; pick a current model in the template editor. DeepSeek V4 Pro reads text only, so use DeepSeek Flash (or another provider) for images and PDFs. DeepSeek runs with its thinking mode switched off, because the importer always asks for a forced structured answer, which DeepSeek only supports without thinking. DeepSeek always gets an output limit (b3s__Output_Tokens__c, else 64K), because its own default cut long extractions off partway through. If a response hits the output limit, with any provider, the run stops with "AI response was cut off by the model's output token limit". Split the file, pick a model that can return more output, or raise b3s__Output_Tokens__c on your own catalog row. Packaged rows set the limit only where the provider documents it; newer rows are blank and use the provider default.
Unlike the other WFM apps, the Shift Importer is not configured through a b3s__Component_Configuration__mdt app-definition record. Its configuration lives as ordinary data on the b3s__Import_Instruction_Set__c object, created and edited entirely in the app with no metadata deploy. A template is a reusable recipe for one kind of source (for example "Client A weekly roster spreadsheet").
provider is gemini, openai or deepseek. Each template record carries three JSON configuration fields:
| Field | Contents |
|---|---|
b3s__Generalist_Config__c |
The primary extraction agent: { prompt, provider, model, dateFormat }, plus the optional compactSource, updateMode and matching settings. |
b3s__Auditors_Config__c |
An array of review agents run in order: [{ name, prompt, provider, model }]. |
b3s__Field_Mapping_Config__c |
An array of field mappings describing the target shift fields the AI must populate. |
{
"prompt": "Extract every shift from this weekly roster. Each row is one worker for one day.",
"provider": "provider-a",
"model": "balanced-model-id",
"dateFormat": "DMY"
}
dateFormat (DMY, MDY or YMD) tells the pipeline how to disambiguate numeric dates in the source.
By default a CSV or Excel file is sent to the AI as a full table in which every cell, filled or empty, carries its own identifier. Schedules produced by macros or third-party systems are often mostly empty space (blocks laid out side by side, spacer columns, helper areas far to the right), and every empty cell is paid for.
Tick Compact spreadsheet format in the template's Basics section ("compactSource": true in the generalist config) to send the same table with less markup. The rows, the columns and the empty cells are all still there, so the AI reads the same layout; only filled cells carry an identifier, and that identifier is the real sheet address.
| Behaviour | Detail |
|---|---|
| Layout | Identical grid to the default format, empty cells included. A blank cell in a flag column (for example an agency marker) is still visible to the AI as blank. |
| Cell identifiers | Sheet addresses such as I7, on filled cells only. |
| Source highlighting | Unchanged for the user. The AI returns sheet addresses and the source viewer in the review step highlights the same cells. |
| Dates | Decoded exactly as in the default format, including the template date format for CSV files. |
| Scope | CSV and Excel files only. Pasted content, images and PDFs are sent as before. |
| Size | On a sparse layout the source is typically 3 to 4 times smaller, which lowers cost and run time. On a dense flat table the saving is smaller. |
The option is off by default and is per template. Before switching a production template, run a file you know well through the template with the option off and on and compare the number of rows and a sample of values.
[
{
"name": "Accuracy check",
"prompt": "Verify every worker name and start/end time against the source. Fix mismatches.",
"provider": "provider-b",
"model": "flagship-model-id"
}
]
An empty array means no audit pass runs; the generalist output goes straight to review.
Each entry maps one target field on b3s__Shift__c. Primitive fields need only the first four keys; the reference keys appear only for lookup (REFERENCE) fields:
[
{
"targetField": "b3s__Start__c",
"targetFieldLabel": "Start",
"description": "Shift start as ISO 8601. Combine the roster date with the start time.",
"type": "datetime",
"sfType": "DATETIME"
},
{
"targetField": "b3s__Contact__c",
"targetFieldLabel": "Worker",
"description": "The worker assigned to this shift.",
"type": "string",
"sfType": "REFERENCE",
"referenceObject": "Contact",
"referenceLabelField": "Name",
"referenceQuery": "AccountId = '{accountId}'"
}
]
| Key | Meaning |
|---|---|
targetField |
API name of the field on b3s__Shift__c to populate. |
targetFieldLabel |
Human label shown in the review grid. |
description |
Instruction the AI uses to interpret and format the value. |
type |
Primitive shape the AI must return (string, number, boolean, date, time, datetime). |
sfType |
The real Salesforce field type (for example REFERENCE, DATETIME, PICKLIST). |
referenceObject |
Lookup target object (reference fields only). |
referenceLabelField |
Field shown when resolving the lookup in the grid (defaults to Name). |
referenceQuery |
Scoping filter for lookup candidates, written as conditions or SOQL (reference fields only, see Reference lookups and query safety). |
referenceQuerySoql |
true when the filter was saved from SOQL mode, so the editor reopens it as SOQL. Editor hint only; it does not change which records match. |
referenceFilterTemplate |
Developer name of an Import Reference Filter custom metadata record (a filter template or an Apex filter). When set it replaces referenceQuery. |
Because field mappings are always validated against the live describe of b3s__Shift__c, any custom shift fields in your org are available as targets, and any target that no longer exists is dropped rather than causing a failed import.
By default every reviewed row becomes a new shift. A template can instead update existing shifts, which is how you load a bulk hours file (for example a third-party clock or client timesheet export) onto the shifts you already scheduled. Turn it on in step 5 of the template editor. The setting is stored in the template's b3s__Generalist_Config__c JSON as updateMode:
{
"prompt": "Each row is one worker's clocked hours for one day.",
"provider": "provider-a",
"model": "balanced-model-id",
"dateFormat": "DMY",
"updateMode": {
"enabled": true,
"matchFields": [
"b3s__Contact__c",
"b3s__Work_Site__c",
{
"field": "b3s__Scheduled_Start_Time__c",
"rowField": "b3s__Actual_Start_Time__c",
"toleranceMinutes": 240
}
],
"unmatched": "insert"
}
}
matchFields is the match key. Every entry must hold:
| Entry | Matches when |
|---|---|
"b3s__Contact__c" (a field name) |
The shift's field equals the row's value for the same field. Use it for lookups (worker, site, job), text and picklist fields. |
{ "field", "rowField", "toleranceMinutes" } |
The shift's date/time field is within toleranceMinutes of the row's rowField value. Use it for times, for example the scheduled start against the clocked start. rowField defaults to field. |
Every rowField (or plain field name) must be one of the template's output fields, so each row carries a value for it; the editor refuses to save otherwise. Lookup values are matched after the review grid resolves them to records, so the worker and site columns must resolve before import. Equality entries work on text, Id, lookup and picklist fields; use a tolerance entry for date and time fields.
How the import behaves in update mode:
IN filters, time keys become one date range around all rows. No SOQL is built in the browser.unmatched: insert creates them as new (ad hoc) shifts, reject marks them as errors in the review grid (No existing shift matches this row) and writes nothing.Unwinding an update-mode run deletes only the shifts the run created. Updated shifts existed before the run, so they are never deleted; correct them in the Shift Management Studio or re-import.
For a clock that sends events one at a time rather than a file, use the time capture integration instead.
A template is either global (offered for every account, the default and how every template created before this feature behaves) or linked to one or more accounts. Links are b3s__Import_Template_Account__c junction records:
| Field | Meaning |
|---|---|
b3s__Import_Instruction_Set__c |
Master-detail to the template. Deleting the template deletes its links. |
b3s__Account__c |
Required lookup to the Account. An Account with template links cannot be deleted until the links are removed. |
In the wizard, once a Context Account is picked, the template list shows the global templates plus the templates linked to that Account. Before an Account is picked every template is listed, so admins can manage them all. Changing the Account clears a selected template the new Account cannot use. Several accounts can share one template.
Manage links in the template editor (step 1, Available for): add accounts with the picker or + Context account, remove them with the cross. No accounts means global. The links are also on the template record page (related list Accounts), so they can be loaded with standard data tools.
The filter is a convenience, not a security boundary. A user without read access on b3s__Import_Template_Account__c sees every template as global. Restrict who sees a template with the sharing of b3s__Import_Instruction_Set__c.
Client sheets rarely use the exact record names: a worker listed as Juanito is the Contact Juan García, and a job written Horneo is the Job Baking. Smart matching resolves these after extraction, before the reviewer sees the grid.
Turn it on per field: in step 3 of the template editor, tick Smart match on a linked-record (lookup) or picklist field. Tune it in step 6 (Smart matching). The settings are stored in b3s__Generalist_Config__c:
{
"prompt": "...",
"provider": "gemini",
"model": "gemini-3.6-flash",
"matching": {
"provider": "gemini",
"model": "gemini-3.1-flash-lite",
"minConfidence": 0.7,
"instructions": "Job names are written in Spanish (Horneo = Baking, Empaquetado = Packing). Workers are often listed by nickname."
}
}
and the field mapping entry carries "aiMatch": true:
{
"targetField": "b3s__Contact__c",
"targetFieldLabel": "Worker",
"description": "The worker assigned to this shift.",
"type": "string",
"sfType": "REFERENCE",
"referenceObject": "Contact",
"referenceLabelField": "Name",
"referenceQuery": "AccountId = '{accountId}'",
"aiMatch": true
}
matching key |
Meaning |
|---|---|
provider, model |
Model used for matching. Blank = Gemini 3.1 Flash-Lite. A cheap, fast model is enough. |
minConfidence |
Lowest AI confidence applied: 0.85 strict, 0.7 balanced (default), 0.5 lenient. |
instructions |
Optional hints for the matcher: translations, naming habits of the client. |
How it runs in the review step, per smart-match column:
juan garcia) are matched without AI. Two records with the same normalised name are never auto-picked.minConfidence are discarded. If two slices confidently match a value to two different records (two people called Juan), the value is left unmatched.Nothing is saved by matching: the reviewer still confirms the grid and clicks import. Matched values are kept when the user leaves and returns to the review step, so matching does not run (or cost) twice. If the matching provider has no key or the call fails, the case and accent pass still applies and a warning tells the reviewer to check the red cells.
Cost and limits: the number of AI calls per column is (unmatched values / 150, rounded up) x (options / 1,000, rounded up). Lookups load at most 45,000 records. With a cheap model a large lookup costs cents per import; narrowing the lookup filter (for example by Account) makes it faster and more accurate. If any call fails the column stays unmatched and the reviewer is warned. Only the option labels and the unmatched values are sent to the AI provider, through the same endpoint as extraction.
When creating a brand new template, an optional quick start can propose a whole template (name, date format, generalist prompt and field mappings) from a single sample file plus the live shift field describe. Every suggested field is validated against the describe, unknown fields are discarded, lookups default their label field to Name, and an Account scoping filter is pre-filled where the referenced object has an Account lookup. It is only offered for new templates. The panel has its own AI model picker: it defaults to the template's extraction model, or to a model of a provider that has a key when that one does not. The choice is used once for the analysis and is not saved with the template.
Each lookup (REFERENCE) field of a template needs a list of candidate records to match the file's values against: the workers, jobs or sites this import may use. The template editor offers four ways to define that list, per field, under Only consider records where:
| Mode | Stored on the field as | Use it when |
|---|---|---|
| Conditions | referenceQuery |
A few field is exactly value rows are enough. Chips insert the import account or the import group as the value. |
| SOQL | referenceQuery |
You need a sub-select. See the supported grammar below. |
| Filter template | referenceFilterTemplate |
An admin has prepared the common filters once, so template authors pick one by label and cannot mistype it. |
| Apex filter | referenceFilterTemplate |
The rule cannot be written as one SOQL filter, for example two levels of sub-select. |
Templates saved before this feature keep working unchanged: they only carry referenceQuery.
| Token | Replaced with |
|---|---|
{accountId} |
The Context Account picked in step 1. |
{groupId} |
The Context Group picked in step 1. |
Write a token with or without single quotes: b3s__Group__c = '{groupId}' and b3s__Group__c = {groupId} are the same. When nothing is selected the token becomes an Id that matches no record, so a filter that uses {groupId} returns no records until a group is picked (it never falls back to records whose lookup is empty). An import started with a group and no account offers global templates only. If a lookup column is empty in the review grid, check first that the template's filter matches what was selected in step 1.
A hand written referenceQuery is not raw SOQL. It is parsed into a structured filter, and every identifier and value is validated and bound server side. Two condition forms are supported, joined by AND:
Field = 'value'
Field IN (SELECT Field FROM Object WHERE Field = 'value' AND Field = 'value')
For example, the workers of the selected group:
Id IN (SELECT b3s__Contact__c FROM b3s__Group_Assignment__c WHERE b3s__Group__c = '{groupId}')
Anything else (OR, LIKE, !=, nested sub-selects) is refused when the template is saved. Use a filter template or an Apex filter for those. Id != null is accepted as "no filter".
b3s__Import_Reference_Filter__mdt holds the reusable filters. Create records in Setup, Custom Metadata Types, Import Reference Filter, Manage Records. No records ship with the package.
| Field | Purpose |
|---|---|
| Label | The name template authors pick. Keep it unique and descriptive, for example Workers of the selected group. |
b3s__Object_Name__c |
API name of the object the filter applies to (Contact, b3s__Job__c, ...). The filter is only offered on lookup fields that point at this object. |
b3s__Filter__c |
A SOQL WHERE clause without the word WHERE. Full SOQL is allowed here (OR, LIKE, one level of sub-select), with the {accountId} and {groupId} tokens. Admin-authored, so it runs as written; the token values are validated as record Ids. |
b3s__Apex_Class__c |
Name of an Apex filter class (see below). A record with this field set is listed under Apex filter, otherwise under Filter template. |
b3s__Description__c |
Shown to the template author under the picker. |
b3s__Active__c |
Untick to retire a filter. A template that still names an inactive or deleted filter shows an error on that column in the review step instead of loading unfiltered records. |
A record may set both a filter and an Apex class; a candidate must then pass both. The clause never leaves the server: the app only receives the label, object and description.
Sample record (in the Version 12 release samples): Group_Workers, object Contact:
Id IN (SELECT b3s__Contact__c FROM b3s__Group_Assignment__c WHERE b3s__Group__c = '{groupId}')
An Apex filter is a class implementing the package's global b3s.FilterPlugin interface, the same interface the scheduler and the portal apps use for loader filters:
global with sharing class ImportAccountGroupWorkers implements b3s.FilterPlugin {
global Set<Id> execute(Map<String, Object> context) {
Id accountId = (Id) context.get('accountId'); // null when not selected
Id groupId = (Id) context.get('groupId'); // null when not selected
String objectName = (String) context.get('objectName');
// return the Ids of the records that may be matched
}
}
The returned Ids are applied as Id IN :ids on the lookup query. Register the class by creating an Import Reference Filter record with b3s__Apex_Class__c set to its name (include your namespace prefix if you have one). The class queries in its own sharing context; the lookup query itself still runs as the user, so a user never sees a record they cannot read.
The sample class ImportAccountGroupWorkers (in the Version 12 release sample wfm-v12-8-shift-import-examples.zip, with the Account_Group_Workers record) returns the contacts assigned to the selected group, or, when only an account is selected, the contacts of every group that account is assigned to. That second case needs two levels of sub-select, which SOQL does not allow in one filter.
All lookup queries run as the signed in user through the structured query endpoint (see Data loading and the app definition JSON); guests cannot use filter templates. One query returns at most 45,000 candidates. A lookup query that fails (bad filter, missing permission, retired filter template) shows an error toast naming the column in the review step.
Every row in the review grid starts with an Ignore checkbox. An ignored row stays in the grid, greyed out and struck through, but it is never imported and its cells are not validated, so a bad row you don't want does not block the import. Click a checkbox to toggle one row. To toggle a block of rows, click the first one, then hold Shift and click the last: every visible row in between takes the same state, in either direction and in the grid's current sort and filter order. Rows that are already imported cannot be ignored. The Ignore column can be sorted and filtered like any other column. When every remaining row is ignored, the import is complete; when every row is ignored and none was imported, the import button warns instead.
On import, the cleaned records (internal markers stripped) are upserted to b3s__Shift__c in batches of the WFM setting Upsert Batch Size (b3s__Upsert_Batch_Size__c, default 200). The import is a partial save: every row that passes is saved, every row that fails shows its own error in the grid (a validation rule, a record-triggered flow, a shift lock) and stays editable. Fix the failing rows and press import again; only the rows not yet saved are sent. A batch that fails as a whole (for example a timeout) marks its own rows failed and the remaining batches still run.
Version note. Up to 12.7 each batch was saved all or nothing: one failing row meant no row of its batch was saved. Upgrade to 12.8 or later for partial saves.
Salesforce re-runs triggers and flows for the passing rows when some rows of a batch fail. That is standard platform behaviour for partial saves; automation on Shift that is not safe to run twice in one transaction should be reviewed.
In update mode rows are first matched to existing shifts.
One b3s__Import_Run__c record follows an import from the moment the AI extraction starts, so a run that never reached the import button is still traceable.
| Moment | What is written |
|---|---|
| The user starts the AI process (step 4) | The run is created with Status Processing, the template, the Context Account and the Context Group. Every uploaded file is attached as it was received; pasted content is attached as Pasted content.html. |
| The AI extraction finishes | extraction.json is attached: the model output exactly as received, one entry per source file (fileName, records). Status becomes Ready to review. |
| The AI extraction fails | Status becomes Error and the reason is added to Tool Errors. |
| The user presses import | Status becomes Imported, the counts are written and results.json is attached. Pressing import again after fixing rows updates the same run: the counts and results.json always cover every row sent in that session. |
| Field | Content |
|---|---|
b3s__Import_Instruction_Set__c |
The template used. |
b3s__Account__c / b3s__Group__c |
The Context Account and Context Group selected in step 1 (either may be blank). |
b3s__Status__c |
Processing, Ready to review, Imported or Error. |
b3s__Success_Count__c |
Rows saved (created or updated). |
b3s__Failed_Count__c |
Rows refused, including update mode rows with no matching shift. |
b3s__Tool_Errors__c |
Timestamped errors from the tool itself or the AI provider: a failed extraction (most often the provider account has run out of credit or hit a rate limit), a lookup query that failed, a save request that failed as a whole, a source file that could not be stored, an unexpected script error. Row-level save errors are not here; they are in results.json. |
| Created By / Created Date | Who ran the import and when. |
| Files | The source files or pasted content, extraction.json, and results.json once imported (one entry per row: success, updated, message, record with the new Id when saved). |
A run left in Processing means the browser was closed or the page was left while the AI was working. Runs created on 12.7 or earlier have a blank status, group, counts and account, no source files and no extraction.json; they are shown as Imported.
A source file too large for one request is not stored; the import continues and the failure is noted in Tool Errors.
Step 1 lists the runs, newest first, with the status, user, template, account, created and failed counts. A red ! next to the status means the run has Tool Errors; hover it to read them. Filter by template, by runs with failures, by your own imports or by the selected account. Clicking a run opens its record in Salesforce.
Resume is offered on runs that are Ready to review (extracted, never imported). It reopens the stored AI output at the review step without running the AI again: the template, account and group of the run are selected, the lookup records are searched again and the grid is shown. The template is used as it is now, so the usual fix is: edit the template (for example change the filter on the worker lookup or pick another filter template), save, then Resume the run. Columns added to the template since the run stay empty, because the AI never extracted them. A run that has already been imported, even partly, cannot be resumed.
The Import Run record page shows the Import Run Results component: the results file as a table with one column per imported field, lookups shown by name and linked, dates in the viewer's time zone, and a filter for All / Failed / Created / Updated rows. It opens on the failed rows when there are any. Nobody needs to read the JSON file. The component is on the packaged Import Run Record Page, which is the default record page for the object; add it to your own Lightning page from the App Builder if you override it. Status and Tool Errors are on the record detail, the files in the Files related list.
To trace a missing shift: filter Past Imports to runs with failures (and the user or account concerned), open the run, read the Message of the failed rows. The message is the org's own error text, for example a validation rule or a flow fault, so it names the customisation to look at. To trace an import that never produced a grid: look for the run in status Error or Processing and read Tool Errors.
A run that was never imported has nothing to delete: unwinding it removes the run and its files. Unwinding an imported run reads its results file, deletes every shift it created (never the ones it updated), then deletes the run record itself. When a shift cannot be deleted (for example it is payrolled or invoiced), the run is kept and a message says how many shifts remain, so they stay traceable. Both the shift delete and the run delete are permission gated, so a user can only unwind what their profile lets them delete.
The importer writes ordinary b3s__Shift__c records, so once committed they are indistinguishable from shifts created any other way. That means they immediately:
The importer deliberately does no scheduler-specific post-processing itself; it just lands correct shift records and lets the downstream apps do their normal work.
b3s__Scheduler__c Custom Setting (org wide): the per-provider API key slot(s) and the b3s__X3B_AI_Endpoint__c endpoint.b3s__Shift__c (target), b3s__Import_Instruction_Set__c (templates), b3s__Import_Template_Account__c (template account links) and b3s__Import_Run__c (run history). The WFM Admin permission set includes all of them. Every call runs as the signed in user, so these permissions are enforced.b3s__Account__c, b3s__Group__c, b3s__Status__c, b3s__Success_Count__c, b3s__Failed_Count__c and b3s__Tool_Errors__c. Without it Past Imports shows a query error and runs are not logged.