VMS user provisioning

Clients (Client Shift Manager) and vendors (Vendor Portal) can manage their own portal users from a Settings tab. The Users section lists everyone with portal access at the account, lets a permitted user add a new user with a chosen User Profile, and deactivate or reactivate users. What a user may hand out is controlled by the profile hierarchy you configure: an Admin can add Admins and Finance users, a Finance user only other Finance users.

The Client Shift Manager Settings tab can also show Reason Codes and Cost Codes sections, where clients with Manage Booking Codes maintain their own account's codes. They follow the same tab gating plus their own permission and schedulables; see Reason codes and cost codes.

Concepts

Concept Where Purpose
Settings tab b3s__User_Profile__c.b3s__Tab_Settings__c Shows the Settings tab and its Users list.
Can Provision Users b3s__User_Profile__c.b3s__Provision_Users__c Shows Add user and the Deactivate / Reactivate buttons.
Provisionable Profile b3s__Provisionable_Profile__c One row per profile a holder of the parent profile may assign.
VMS Role Contact.b3s__VMS_Role__c Client, Vendor or Worker. Separates portal users from workers.
Deactivated Contact.b3p__Disabled_Portal_User__c The portal sign-in flag. Checked = the user can no longer sign in.

VMS Role

Value Meaning Shown in
Client Client portal user Client Shift Manager Settings → Users
Vendor Vendor portal user Vendor Portal Settings → Users
Worker A vendor's worker Vendor Portal Workers tab
blank Treated as a worker Vendor Portal Workers tab

Users added from Settings are stamped automatically. Workers added from the Vendor Portal Workers tab are stamped Worker. The packaged Contact record page shows it in the Workforce section (see Contact and Account record pages); add it to your list views so the master vendor can see at a glance what kind of contact a record is.

Existing orgs: set VMS Role on your existing client and vendor portal contacts. A contact without the matching role cannot add or deactivate users (for example with a data load). Until you do, existing vendor users keep appearing on the Workers tab and no user appears in Settings → Users.

Setup walkthrough

1. Give the profiles the permissions

On each User Profile that should manage users, check Settings Tab and Can Provision Users. Profiles that should only see the list need Settings Tab alone.

2. Configure Provisionable Profiles

Open the provisioning profile and use the Provisionable Profiles related list. Add one row per profile its holders may assign, in Assignable Profile. Include the profile itself to let holders add peers.

Example:

User Profile Assignable Profile
Client Admin Client Admin
Client Admin Client Finance
Client Finance Client Finance

A profile with Can Provision Users but no Provisionable Profile rows can open Settings but sees "Your profile cannot assign any User Profile" when adding a user.

3. Make sure the app definitions declare the user schedulable

The shipped sample configurations (WFM_Client_Shift_Manager, WFM_Vendor_Portal) already contain it. If your configuration does not have a user schedulable, the Settings tab is hidden. See Definition configuration.

Adding a user

The form collects First Name, Last Name, Email, Account and User Profile. Account offers your own account (preselected) and its direct child accounts, for example a trust and its schools. In the Client Shift Manager it is a multi-select: a client user can be given several accounts at once. User Profile offers only the profiles you may assign. On save the server:

  1. Checks that your own contact has the VMS Role of this portal (Client in the Client Shift Manager, Vendor in the Vendor Portal), that you hold Can Provision Users on your own account and that the chosen profile is one of your Provisionable Profiles.
  2. Rejects a missing or invalid email, and an email already used by any contact.
  3. Checks every chosen account is your own account or one of its direct children (blank = your own account). Vendor users take exactly one account. It then creates the Contact on your own account when you picked it, otherwise on the first account picked, with VMS Role = Client (Client Shift Manager) or Vendor (Vendor Portal). The role is always set by the server, never taken from the form.
  4. Queries Account Memberships after the Contact is created. For each chosen account, it applies the chosen profile to an existing membership or creates one if missing. This reuses the blank membership created by Contact to Account Membership Sync, preventing a second membership for the same Contact and Account in both portals. Portal access comes from Account Memberships only; the Contact itself carries no profile.

From 12.5.0, the form stays open with Save busy until the server answers. On success it closes and the user list reloads. If saving fails, the Contact and membership changes are rolled back, and the error appears at the top of the open form with the entered values preserved. This duplicate prevention applies to new provisioning operations; it does not remove duplicates already stored.

Deactivating and reactivating a user

Deactivate sets b3p__Disabled_Portal_User__c on the contact; Reactivate clears it. You can manage a user when all of these are true:

A user with no membership profile at all cannot be managed from the portal. An administrator handles them in Salesforce.

Deactivation blocks the next portal sign-in. A session the user already has keeps working until its session key expires.

Definition configuration

Both app definitions carry a user schedulable and a users loader.

"user": {
    "objectType": "Contact",
    "loaderName": "users",
    "accountFieldPaths": ["AccountId", "Account.ParentId"],
    "accountSelectFieldPath": "AccountId",
    "accountNameFieldPath": "Account.Name",
    "nameFieldPath": "Name",
    "emailFieldPath": "Email",
    "profileFieldPath": "$userProfileId",
    "disabledFieldPath": "b3p__Disabled_Portal_User__c",
    "canEdit": false,
    "canDelete": false,
    "recordFormFields": [
        { "field": "FirstName", "type": "field-text", "required": true, "columns": "col-span-2" },
        { "field": "LastName", "type": "field-text", "required": true, "columns": "col-span-2" },
        { "field": "Email", "type": "field-text", "required": true, "columns": "col-span-2" },
        { "field": "AccountId", "type": "field-select", "label": "Accounts", "isMultiselect": true, "required": true, "columns": "col-span-2" },
        { "field": "$userProfileId", "type": "field-select", "label": "User Profile", "required": true, "columns": "col-span-2" },
        { "field": "b3s__VMS_Role__c", "type": "field-select", "hidden": true, "default": "Client" }
    ]
}
Key Purpose
loaderName Loader whose rows fill the Users list.
accountFieldPaths Accounts of a user row (own and parent account), for the per-account button checks.
accountSelectFieldPath The form field that receives your own account and its child accounts as its options, preselected to your own account. Set isMultiselect on that field in the Client Shift Manager to allow several accounts (never in the Vendor Portal). Leave it off the form to always add users to your own account.
accountNameFieldPath Account name shown on each user row.
profileFieldPath The form field that receives the assignable profiles as its options. Use $userProfileId: the pick is not a Contact field, the server reads it and writes it on the new user's Account Memberships.
nameFieldPath, emailFieldPath, disabledFieldPath What the list shows. Load them in the loader. The profile column is filled by the server (getUserProfiles), not the loader.
recordFormFields The Add user form. Use "default": "Vendor" on the hidden role field in the Vendor Portal.

The fields listed in recordFormFields are the only Contact fields a save may set: the server reads the same definition and rejects any other field. To collect another field (for example Phone), add it to the form. LastName, Email and $userProfileId must stay on the form. The account and VMS Role are always set by the server, whatever the form sends.

Loader (Vendor Portal uses 'Vendor'):

{
    "name": "users",
    "objectName": "Contact",
    "filterRecordsBy": [
        "(AccountId IN :accountIds(b3s__Tab_Settings__c) OR Account.ParentId IN :accountIds(b3s__Tab_Settings__c)) AND b3s__VMS_Role__c = 'Client'"
    ],
    "groupRecordsBy": "Id",
    "fieldToLoad": [
        "Name",
        "FirstName",
        "LastName",
        "Email",
        "AccountId",
        "Account.Name",
        "Account.ParentId",
        "b3p__Disabled_Portal_User__c"
    ]
}

The Vendor Portal workers loader excludes portal users:

AccountId IN :accountIds AND b3s__VMS_Role__c NOT IN ('Client', 'Vendor')

Blank roles still match, so existing workers stay on the Workers tab.

Server reference

All four actions go through the global Callable b3s.UserProvisioningService, reached from the portals like every other remoting call. Only sessions with an access profile (governed sessions) in the Client Shift Manager or Vendor Portal may use it, and the acting contact's own VMS Role must match the portal. Signed-in community users always act as their own contact; a contactId argument is ignored. Internal Salesforce users previewing the portal as a contact (contactId) act as that contact, but can only add users if they can create Contacts and Account Memberships and only deactivate users if they can edit Contacts.

endp Arguments Returns
getAssignableProfiles none { "accountId": "001...", "accounts": [{ "label": "Oakwood Trust", "value": "001..." }], "profiles": [{ "label": "Client Finance", "value": "a0X..." }] }
provisionUser record: the form fields, the profile pick as $userProfileId { "contactId": "003..." }
getUserProfiles none { "profilesByContact": { "003...": "Client Admin, Client Finance" } }
setUserDisabled userId, disabled (true / false) { "contactId": "003...", "disabled": true }

Example request and error:

{
    "endp": "provisionUser",
    "record": {
        "FirstName": "Ana",
        "LastName": "Diaz",
        "Email": "ana@client.example",
        "$userProfileId": "a0X..."
    }
}
{
    "success": false,
    "message": "Your profile does not allow assigning this User Profile."
}

getUserProfiles returns, for each user in the Users list scope, the distinct names of the profiles they hold through their Account Memberships, sorted and comma-joined. The scope matches the users loader: contacts with this portal's VMS Role whose account, or whose account's parent, grants you Settings Tab. Users with no membership profile are left out.

{ "endp": "getUserProfiles" }
{
    "success": true,
    "responseObject": {
        "profilesByContact": {
            "003AA000001": "Client Admin",
            "003AA000002": "Client Admin, Client Finance"
        }
    }
}

b3s__Provisionable_Profile__c, like User Profile and Account Membership, can never be read or written by a portal session. Administrators maintain it in Salesforce (the WFM Admin permission set grants it).

Known limits