Clients often need two extra facts on every booking:
Both are optional fields on Shift, Booking Request and Working Pattern (placement). The client picks them on the request form, they travel with the request to the placement and every generated shift, and reports, invoice backing sheets and integrations read them as plain shift fields.
| Reason Code | Cost Code | |
|---|---|---|
| Field on the record | b3s__Reason_Code__c (Text 80) |
b3s__Cost_Center__c (Lookup to Cost Center) |
| On objects | Shift, Booking Request, Working Pattern | Shift (already present), Booking Request, Working Pattern |
| Allowed values | b3s__Booking_Code__c rows of Type Reason |
b3s__Cost_Center__c rows of the account |
| Global values | Yes (Account blank) | No (a cost center always belongs to one account) |
| Checked on save | Yes, on Shift and Booking Request | No (see Known limitations) |
| Mandatory | No | No |
Reason Code is a text field holding the code itself (for example ABS), not a lookup. The value is the Name of a Booking Code. This keeps the relationship count on Shift, Booking Request and Working Pattern low, and the stamped value survives later edits to the code list: renaming or deactivating a Booking Code never rewrites records that already carry it.
The cost code reuses the existing Cost Center object, which already scopes rate cards and break rulesets. Choosing a cost code on a shift therefore also feeds pay and bill pricing when your rate cards or break rulesets are anchored on a cost center (see Pay and bill engine and Break engine).
b3s__Booking_Code__c)The list of allowed codes. One object for every code type: future code types become new Type__c values, not new objects. Tab Booking Codes in the 3B WFM and 3B VMS apps; the WFM Admin permission set has full access.
| Field | Type | Meaning |
|---|---|---|
Name (label Code) |
Text | The exact value stamped on the record, for example ABS. Matching is case sensitive. |
b3s__Type__c |
Picklist, restricted, required | Which record field the code is offered for. Only Reason today (default), used by b3s__Reason_Code__c. |
b3s__Description__c |
Text 255 | Shown next to the code in the pickers. |
b3s__Account__c |
Lookup Account, delete Restrict | Blank = a global code offered to every client. Set = that client's own code. An account with booking codes cannot be deleted until its codes are deleted (clearing the account would silently turn them into global codes). |
b3s__Active__c |
Checkbox, default checked | Inactive codes are no longer offered or accepted on new or changed records. Records already stamped keep their value. |
b3s__Sort_Order__c |
Number | Intended option order (blank last). Not yet honoured by the portal picker, see Known limitations. |
b3s__Cost_Center__c) as the cost codeThe existing Cost Center object (Master-Detail to Account, auto-number Name CC-{0}) gets three new fields:
| Field | Type | Meaning |
|---|---|---|
b3s__Code__c |
Text 80 | The client's own cost code, for example MATHS. This is what the portal shows. Not unique. |
b3s__Description__c |
Text 255 | Shown next to the code in the pickers. |
b3s__Active__c |
Checkbox, default checked | Inactive cost centers are no longer offered in the pickers. Records already stamped keep them. |
Because the account is a Master-Detail, a cost center cannot move to another account once saved.
| Object | New fields |
|---|---|
b3s__Shift__c |
b3s__Reason_Code__c (b3s__Cost_Center__c already existed) |
b3s__Booking_Request__c |
b3s__Reason_Code__c, b3s__Cost_Center__c (Lookup, delete Set Null) |
b3s__Working_Pattern__c |
b3s__Reason_Code__c, b3s__Cost_Center__c (Lookup, delete Set Null) |
The shipped page layouts of all three objects and the WFM Admin permission set include the fields. Add them to any custom layouts, profiles and permission sets your users work with, including the portal guest or community profiles that create requests.
Reason, Description, Sort Order, Account blank, Active.b3s__Manage_Booking_Codes__c) on the User Profiles of client users who should maintain their account's codes (see Access).WFM_Client_Shift_Manager already contains them.The shipped shift and bookingRequest schedulables have two optional selects after PO Number. Both use loaders, so the options come from the org data.
Include these entries in the Client Shift Manager configuration’s b3s__Loaders__c array. The second clause in each loader brings in active codes from direct parent accounts.
[
{
"name": "reasonCodes",
"objectName": "b3s__Booking_Code__c",
"filterRecordsBy": [
"b3s__Active__c = true AND b3s__Type__c = 'Reason' AND (b3s__Account__c = null OR b3s__Account__c IN :accountIds)",
"b3s__Active__c = true AND b3s__Type__c = 'Reason' AND b3s__Account__c IN (SELECT ParentId FROM Account WHERE Id IN :accountIds) AND b3s__Account__c NOT IN :accountIds"
],
"groupRecordsBy": "Id",
"fieldToLoad": [
"Name",
"b3s__Description__c",
"b3s__Account__c",
"b3s__Account__r.ParentId",
"b3s__Sort_Order__c"
]
},
{
"name": "costCodes",
"objectName": "b3s__Cost_Center__c",
"filterRecordsBy": [
"b3s__Active__c = true AND b3s__Account__c IN :accountIds",
"b3s__Active__c = true AND b3s__Account__c IN (SELECT ParentId FROM Account WHERE Id IN :accountIds) AND b3s__Account__c NOT IN :accountIds"
],
"groupRecordsBy": "Id",
"fieldToLoad": [
"Name",
"b3s__Code__c",
"b3s__Description__c",
"b3s__Account__c",
"b3s__Account__r.ParentId"
]
}
]
:accountIds is every account the contact acts for (ungoverned contacts: their own account). See VMS access profiles.
{
"field": "b3s__Reason_Code__c",
"labelOverride": "Reason Code",
"type": "field-select",
"required": false,
"disabled": false,
"columns": "col-span-2",
"optionsInPopout": true,
"loader": "reasonCodes",
"optionLabelField": "Name",
"optionValueField": "Name",
"optionExtendedDetails": [
{ "label": "Description", "targetField": "b3s__Description__c" }
],
"showOptionIf": {
"condition": {
"allOrSome": "some",
"selectors": [
{ "field": "$accountId", "operator": "isnull", "value": true },
{ "field": "$accountId", "operator": "equals", "targetField": "b3s__Account__c" },
{ "operator": "equals", "targetField": "b3s__Account__r.ParentId" },
{ "operator": "equals", "targetField": "b3s__Account__c" }
]
}
}
}
optionValueField is a field definition key for loader-backed selects: the path on the loader record stored as the value. By default a loader select stores the record Id, which suits lookups. Reason Code is a text field, so "optionValueField": "Name" stores the code itself. Use it for any text field fed by a loader.
The sample shows every loaded option until the client chooses an account. After selection, it offers codes owned by the selected account, global reason codes and loaded codes whose owning account has no parent. That last condition lets a school use codes from its trust. With several unrelated top-level accounts in scope, it can also display their codes. A reason code must still be global or belong to the record, job or site account to pass validation. Validation
{
"field": "b3s__Cost_Center__c",
"labelOverride": "Cost Code",
"type": "field-select",
"required": false,
"disabled": false,
"columns": "col-span-2",
"optionsInPopout": true,
"loader": "costCodes",
"optionLabelField": "b3s__Code__c",
"optionExtendedDetails": [
{ "label": "Description", "targetField": "b3s__Description__c" }
],
"showOptionIf": {
"condition": {
"allOrSome": "some",
"selectors": [
{ "field": "$accountId", "operator": "isnull", "value": true },
{ "field": "$accountId", "operator": "equals", "targetField": "b3s__Account__c" },
{ "operator": "equals", "targetField": "b3s__Account__r.ParentId" }
]
}
}
}
The form shows the Code and stores the Cost Center Id. Cost centers belong to accounts. The final selector admits loaded centers owned by a top-level account, such as the trust in the UK education demo.
The shift and booking request cards show both values through the schedulables' title lists:
{ "label": "Reason Code", "fieldPath": "b3s__Reason_Code__c", "hideIfNull": true },
{ "label": "Cost Code", "fieldPath": "b3s__Cost_Center__r.b3s__Code__c", "hideIfNull": true }
The bookingRequests loader's fieldToLoad includes b3s__Reason_Code__c, b3s__Cost_Center__c and b3s__Cost_Center__r.b3s__Code__c. Shift field paths are picked up from the shift schedulable automatically.
Regular (non-VMS) shift form. The regular schedule uses the same shift form without the wizard's Account step, so $accountId is blank and selector 1 shows every loaded code: global reason codes and active codes from the accounts and direct parents in the loaders. A contact acting for several accounts can therefore pick another account's own reason code, which the server rejects on save (see Validation).
The four shipped scheduler context providers (WFM_Account, WFM_Job, WFM_Group, WFM_Contact) carry the same two loaders and the same two selects on the shift form, after Site Location. Internal users have no :accountIds, so each loader is scoped by the scheduler context instead:
| Provider | Loader scope (reasonCodes also adds b3s__Account__c = null for global codes) |
|---|---|
WFM_Account |
b3s__Account__c =:contextId |
WFM_Job |
b3s__Account__c =:contextRecord.b3s__Account__c (the job's account) |
WFM_Group |
b3s__Account__c IN (SELECT b3s__Account__c FROM b3s__Group_Assignment__c WHERE b3s__Group__c =:contextId) |
WFM_Contact |
No account filter: every active code. The form narrows the options by the shift's job account. |
The selects filter options by the shift's job account instead of $accountId:
"showOptionIf": {
"condition": {
"allOrSome": "some",
"selectors": [
{ "field": "b3s__Work_Job__c", "operator": "isnull", "value": true },
{ "field": "b3s__Work_Job__c", "fieldLoader": "jobs", "fieldLoaderField": "b3s__Account__c", "operator": "equals", "targetField": "b3s__Account__c" },
{ "operator": "equals", "targetField": "b3s__Account__c" }
]
}
}
No job yet shows every loaded code; once a job is picked, only the job account's own codes (plus global reason codes, via the no-field selector) remain. The Cost Code select omits the third selector. Both selects show in the shift, bulk edit and bulk create views. A job whose account differs from the site account still validates on save, because the server accepts the job account (see Validation).
The Client Shift Manager Settings tab gets two sections, Reason Codes and Cost Codes, next to Users. Each lists the client's own codes (inactive included) as cards with an Active or Inactive badge, a search box and an Active / Inactive / All scope (default Active). Add and Edit open a form; global codes are never listed or editable here.
A section is shown when all of these hold:
Tab_Settings__c and the user schedulable, see VMS user provisioning);reasonCode or costCode);The form's Account select offers only the accounts that grant Manage Booking Codes. It defaults to the account selected in the header when exactly one manageable account is selected, else to the only manageable account. On an existing Cost Code the Account is disabled, because the Master-Detail cannot be changed. After a save the section reloads and the request form's loader is reloaded too, so a new code can be picked straight away.
Codes are deactivated, not deleted: there is no delete button and the server refuses client deletes.
Renaming a reason code does not change records that already carry the old value. Add a new code and deactivate the old one instead.
Both sections are rendered by one generic code list component driven by these keys:
| Key | Meaning |
|---|---|
objectType |
Object the list maintains. |
loaderName |
Loader listing the client's own codes, inactive included. |
formLoaderName |
Loader the request forms read, reloaded after a save. |
accountFieldPaths |
Account paths used to decide which rows the user can manage. |
accountSelectFieldPath |
Form field fed with the manageable accounts (locked on edit when the field is not updateable). |
nameFieldPath |
Card heading and sort key. |
activeFieldPath |
Checkbox driving the Active / Inactive badge and scope. |
title |
Fields shown on each card. |
recordFormFields |
The Add / Edit form. |
Shipped sample:
"reasonCode": {
"objectType": "b3s__Booking_Code__c",
"loaderName": "manageReasonCodes",
"formLoaderName": "reasonCodes",
"accountFieldPaths": ["b3s__Account__c"],
"accountSelectFieldPath": "b3s__Account__c",
"nameFieldPath": "Name",
"activeFieldPath": "b3s__Active__c",
"title": [
{ "label": "Description", "fieldPath": "b3s__Description__c", "hideIfNull": true },
{ "label": "Account", "fieldPath": "b3s__Account__r.Name", "hideIfNull": true },
{ "label": "Sort Order", "fieldPath": "b3s__Sort_Order__c", "hideIfNull": true }
],
"recordFormFields": [
{ "field": "Name", "labelOverride": "Reason Code", "type": "field-text", "required": true, "columns": "col-span-2" },
{ "field": "b3s__Description__c", "type": "field-text-area", "required": false, "columns": "col-span-2" },
{ "field": "b3s__Account__c", "labelOverride": "Account", "type": "field-select", "required": true, "columns": "col-span-2" },
{ "field": "b3s__Sort_Order__c", "labelOverride": "Sort Order", "type": "field-number-input", "required": false, "columns": "col-span-2" },
{ "field": "b3s__Active__c", "labelOverride": "Active", "type": "field-checkbox", "default": true, "columns": "col-span-2" },
{ "field": "b3s__Type__c", "type": "field-select", "hidden": true, "default": "Reason" }
]
},
"costCode": {
"objectType": "b3s__Cost_Center__c",
"loaderName": "manageCostCodes",
"formLoaderName": "costCodes",
"accountFieldPaths": ["b3s__Account__c"],
"accountSelectFieldPath": "b3s__Account__c",
"nameFieldPath": "b3s__Code__c",
"activeFieldPath": "b3s__Active__c",
"title": [
{ "label": "Description", "fieldPath": "b3s__Description__c", "hideIfNull": true },
{ "label": "Account", "fieldPath": "b3s__Account__r.Name", "hideIfNull": true }
],
"recordFormFields": [
{ "field": "b3s__Code__c", "labelOverride": "Cost Code", "type": "field-text", "required": true, "columns": "col-span-2" },
{ "field": "b3s__Description__c", "type": "field-text-area", "required": false, "columns": "col-span-2" },
{ "field": "b3s__Account__c", "labelOverride": "Account", "type": "field-select", "required": true, "columns": "col-span-2" },
{ "field": "b3s__Active__c", "labelOverride": "Active", "type": "field-checkbox", "default": true, "columns": "col-span-2" }
]
}
Manage loaders:
{
"name": "manageReasonCodes",
"objectName": "b3s__Booking_Code__c",
"filterRecordsBy": [
"b3s__Type__c = 'Reason' AND b3s__Account__c IN :accountIds(b3s__Manage_Booking_Codes__c)"
],
"groupRecordsBy": "Id",
"fieldToLoad": ["Name", "b3s__Type__c", "b3s__Description__c", "b3s__Account__c", "b3s__Account__r.Name", "b3s__Active__c", "b3s__Sort_Order__c"]
},
{
"name": "manageCostCodes",
"objectName": "b3s__Cost_Center__c",
"filterRecordsBy": ["b3s__Account__c IN :accountIds(b3s__Manage_Booking_Codes__c)"],
"groupRecordsBy": "Id",
"fieldToLoad": ["Name", "b3s__Code__c", "b3s__Description__c", "b3s__Account__c", "b3s__Account__r.Name", "b3s__Active__c"]
}
The Vendor Portal shares the Settings tab but its sample defines neither schedulable, so the sections never appear there. Section and card labels come from the common.settings.sections.reasonCodes / costCodes and common.codeList.* translation keys (see App translations).
Both values follow the same path as PO Number:
| Step | What is copied |
|---|---|
| Single shift request approved | The shift keeps its own values. |
| Demand placement approved | The child shift is cloned from the demand with every createable field, so both values carry over. |
| Booking request approved | The new placement (b3s__Working_Pattern__c) gets the booking request's Reason Code and Cost Center. |
| Placement shifts generated | Each shift gets the placement's value, else the booking request's (separately for each field). |
Copies are not re-validated: the value was already accepted on the request, so a code deactivated after the request was raised still reaches the placement and its shifts.
On insert and update of Shift and Booking Request, a Reason Code that is non-blank and new (insert) or changed (update) must equal the Code of an active Booking Code of Type Reason whose Account is blank (global) or one of the record's accounts:
| Record | Accounts checked |
|---|---|
| Shift | b3s__Account__c, the job's account (b3s__Work_Job__r.b3s__Account__c), the site's account (b3s__Work_Site__r.b3s__Account__c) |
| Booking Request | b3s__Account__c, the job's account, the site's account |
Otherwise the save fails on the Reason Code field with the custom label Reason_Code_Not_Allowed: "Reason Code {0} is not an active reason code for this account." Translate or reword it with Salesforce label translations.
Portal users are validated against the same codes as internal users. Unchanged values are never re-checked, so records keep a code after it is deactivated. Package processes that copy an already-accepted value (proposal approval, placement shift generation) do not re-check it. The check runs on save, after the rate basis template check.
New User Profile checkbox:
| Field | Label | Grants |
|---|---|---|
b3s__Manage_Booking_Codes__c |
Manage Booking Codes | Client: maintain the account's cost codes and reason codes in Settings. |
Server rules for governed Client Shift Manager sessions (writes are deny by default):
| Object | Operations | Permission | Scope |
|---|---|---|---|
| Cost Center | C, U | Manage Booking Codes | b3s__Account__c is an account granting the permission |
| Booking Code | C, U | Manage Booking Codes | b3s__Account__c is an account granting the permission |
reasonCodes).See VMS access profiles.
Both values are plain fields on the shift, so standard reports on shifts group and filter on Reason Code and Cost Center: Code (b3s__Cost_Center__r.b3s__Code__c) with no extra setup. Booking requests and placements report the same way.
To show them on an invoice backing sheet, add columns to the invoice configuration's backing sheet JSON (paths are from the staging line):
{ "fieldPath": "b3s__Shift__r.b3s__Reason_Code__c", "label": "Reason" },
{ "fieldPath": "b3s__Shift__r.b3s__Cost_Center__r.b3s__Code__c", "label": "Cost code" }
To split or group invoices by cost code, use the same paths in the configuration's split or group rules. See Invoicing.
The VMS_UK_EDU demo data template (Demo Data tab, see UK education demo data) creates active reason codes for the demo trust, Northwind Academy Trust: ABS (staff absence), VAC (vacancy cover), CPD (training cover), EXAM (exam invigilation), SEN (additional SEN support) and INSET (trust INSET day cover), plus cost centers MATHS (mathematics), SCI (science) and SEN (inclusion budget). It also gives the Client - Full Access profile Manage_Booking_Codes__c.
Running Deploy demo data again matches reason codes by trust account, Type Reason and Name. It matches cost centers by trust account and Code, preserves record IDs and reactivates the seeded codes. Delete demo data removes booking codes across the demo org before deleting demo accounts.
required or add a validation rule.| Symptom | Cause | Fix |
|---|---|---|
| "Reason Code X is not an active reason code for this account." | The code is inactive, has a different Type, differs in case, or belongs to an account that is not the record's, job's or site's account. | Activate the code, correct its account, or pick a global code. |
| The Reason Codes / Cost Codes section is missing in Settings | The definition lacks the reasonCode / costCode schedulable, the profile lacks Manage Booking Codes on every account, or the Settings tab itself is hidden. |
Compare with the shipped sample; check the User Profile. |
| A new code does not appear in the request form | The code is inactive, belongs to another account, or the form loader name in formLoaderName does not match the form's loader. |
Check the code and the definition. |
| A client save of a code fails | The account does not grant Manage Booking Codes, or the row is global. | Grant the permission on that account's profile; global codes are internal only. |
| The Cost Code select is empty | The costCodes loader is missing or the account has no active cost centers with a Code. |
Add Cost Center rows with b3s__Code__c set. |