Skip to main content

Widget UserPicker

The UserPicker widget provides a searchable dropdown interface for selecting one or multiple users from your application's user base. It supports remote search, group filtering, and flexible display options.

OverviewDirect link to Overview

The UserPicker widget renders as an Element UI select component with remote search capabilities. Users can search and select from the application's user directory with real-time filtering and group-based restrictions.

UserPicker Widget
UserPicker Widget
Pages on an old engine version

The behaviours described on this page are those of the current engine. A page that still runs on the old engine (banner and Upgrade button, see Pages on an old version of the engine) displays emails when the widget has no label; with Name, it displays the last name first and no email on the right. It also proposes blocked users and does not fill <model>_vb, and its On Change row is a plain text field, without the Action on field change button, that this widget does not run.

Configuration PropertiesDirect link to Configuration Properties

Basic PropertiesDirect link to Basic Properties

NameDirect link to Name

  • Description: Display label for the widget
  • Type: String
  • Default: "UserPicker"
  • Usage: Appears as the form label above the selection field

Variable/ModelDirect link to Variable/Model

  • Description: The data model variable name that will store the selected user(s)
  • Type: String
  • Required: Yes
  • Format: Must be a valid variable name (e.g., selectedUser, assignedUsers)

Selection OptionsDirect link to Selection Options

Multiple SelectionDirect link to Multiple Selection

  • Property: multiple
  • Type: Boolean
  • Default: false
  • Description: Enable selection of multiple users
  • When enabled: Returns an array of selected user emails
  • When disabled: Returns a single user email string

ClearableDirect link to Clearable

  • Property: clearable
  • Type: Boolean
  • Default: true
  • Description: Adds a clear button to remove all selections

User FilteringDirect link to User Filtering

Groups FilterDirect link to Groups Filter

  • Property: groupes
  • Type: Array of Group Objects
  • Description: Restrict user selection to specific groups
  • Configuration: Select one or more groups from the dropdown
  • API Behavior: Only users belonging to the selected groups will appear in search results

Active Users OnlyDirect link to Active Users Only

Only active users are proposed: the widget searches with onlyActive=true, which leaves out blocked users (deleted users are never returned). A blocked user who is already stored in the field stays displayed.

The list shows 10 users at most. Type part of a first name, a last name, a full name or an email to find the others.

Label DisplayDirect link to Label Display

  • Property: label
  • Type: String
  • Options:
    • "name" (Name in the panel): Display user's first name + last name
    • "Email" (Email in the panel): Display user's email address
  • Default: "name"
  • Description: Determines how users are displayed in the dropdown options and in the field

With Name, each option also shows the user's email on the right, so that two users with the same name can be told apart. Once a user is selected, the field only shows the name.

With the Name label, each option shows the name and, on the right, the email
With the Name label, each option shows the name and, on the right, the email
Changed in version 8.6

Up to version 8.5, a widget saved without a label displayed emails, and the options did not show the email next to the name. Since version 8.6, on pages that run on the current engine, a widget without a label displays names, like a new widget, and the Name options show the email on the right.

UserPicker Configuration
UserPicker Configuration

Validation and VisibilityDirect link to Validation and Visibility

Screen-Based ConfigurationDirect link to Screen-Based Configuration

The User Picker supports different configurations for different screens/contexts:

  • Available: Controls widget availability on the interface
  • Visible: Controls widget visibility on the interface
  • Required: Makes user selection mandatory for form submission
  • Disable: Disables the widget preventing user interaction
UserPicker Basic Validation
UserPicker Basic Validation

Advanced Visibility ConditionsDirect link to Advanced Visibility Conditions

Use JavaScript expressions for complex visibility logic:

UserPicker Advanced Validation
UserPicker Advanced Validation

Style and AppearanceDirect link to Style and Appearance

Placeholder TextDirect link to Placeholder Text

  • Property: placeholder
  • Type: String
  • Default: empty
  • Description: Placeholder text displayed when no selection is made

WidthDirect link to Width

  • Property: width
  • Type: String
  • Default: empty (the field keeps its standard width)
  • Examples: "300px", "50%", "auto"
  • Description: Controls the width of the selection field

CSS ClassesDirect link to CSS Classes

  • Property: classNames
  • Type: String
  • Description: Custom CSS classes for styling
  • Format: Space-separated class names

Dynamic ClassesDirect link to Dynamic Classes

  • Property: classes
  • Type: JavaScript Object
  • Description: Conditional CSS classes based on form state
  • Usage: Advanced styling based on data conditions
User Picker Style
User Picker Style

Validation RulesDirect link to Validation Rules

Add custom validation rules beyond basic required validation, in the Rules card: click Add rule, choose the type, then enter its value and the error message.

Rule TypesDirect link to Rule Types

  • Min (Char) / Max (Char): Minimum and maximum number of characters of the value. With a single selection, they count the characters of the email. With Multi, they reject every value, even an empty selection: do not use them to set a number of selections.
  • Type: Expected type of the value (array, date, number). The value of this widget is a text, or an array with Multi: array only passes with Multi, and date and number never pass.
  • Email: The value must be an email address. With Multi, the rule only passes with exactly one selected user.
  • Regex: The value must match a regular expression. With Multi, it is tested on the emails joined by commas, and an empty selection does not pass.
  • Custom: A condition to satisfy, where SF_input is the value of the field. It is also checked when the field is empty.

To set a number of selections, use Custom with Multi: SF_input.length >= 2 requires at least two users.

UserPicker Validation Rules
UserPicker Validation Rules

Usage ExamplesDirect link to Usage Examples

Basic Single User SelectionDirect link to Basic Single User Selection

UserPicker Basic Single User
UserPicker Basic Single User

Multiple User Selection with Group FilterDirect link to Multiple User Selection with Group Filter

UserPicker Multiple User Selection
UserPicker Multiple User Selection

Events and InteractionsDirect link to Events and Interactions

onChange EventDirect link to onChange Event

Set it in the On Change row of the Global card: Action on field change creates the action, then View attached action opens it. The action editor titles it On Click.

  • Trigger: When user selection changes
  • Data Available:
    • SF_input.value: Selected user email(s)
    • SF_input.SF_data: Selected user object (null when the field is cleared), or array of user objects with Multi. See User Objects
    • SF_input.SF_currentIndex: Current loop index (if in a loop)
UserPicker Action
UserPicker Action

Data StructureDirect link to Data Structure

Input Data (Selected Values)Direct link to Input Data (Selected Values)

// Single selection
"user@example.com"

// Multiple selection
["user1@example.com", "user2@example.com", "user3@example.com"]

Variables Kept by the WidgetDirect link to Variables Kept by the Widget

VariableContent
<model>Email of the selected user, or array of emails with Multi
<model>_labelDisplayed text: name(s) with the Name label, email(s) with Email
<model>_vbArray with one { email, firstName, lastName } object per selected user
// assigned_user_vb
[{ "email": "john.doe@example.com", "firstName": "John", "lastName": "Doe" }]

In the model, <model>_vb only receives these three fields: never tokens, rights, login data or any other field of the user account, because the variables of a page can be sent to a process or saved with the form data.

With the page option Remove VB lists from the model, which is on for the pages created in the IDE, <model>_vb is not part of the model at all: it is neither sent to the process nor saved.

To read the _id or another field of the user, use SF_input.SF_data in the On Change action or the Users class, not <model>_vb.

Changed in version 8.6

Up to version 8.5, <model>_vb held the whole user object returned by the server. If your page reads another field from it, for example <model>_vb[0]._id, read it from SF_input.SF_data or the Users class instead.

Values saved before version 8.6 keep their old content until the selection changes: a page that reads <model>_vb[0]._id can therefore work on old records, then fail on new records or as soon as the selection changes. If Remove VB lists from the model was turned on after these records were saved, the widget no longer updates this variable and the old content stays in them.

User Objects (Available in SF_data)Direct link to User Objects (Available in SF_data)

{
  "_id": "user_id_123",
  "email": "john.doe@example.com",
  "firstName": "John",
  "lastName": "Doe",
  "lg": "en",
  "profilePicture": {},
  "group": []
}

The fields returned depend on the connected user, in SF_input.SF_data as in the Users class:

  • Without IDE access: _id, email, firstName, lastName, lg, profilePicture and the groups of the user.
  • With IDE access: the other fields of the account too, including metadata_test, metadata_uat and metadata_prod. Passwords and reset tokens are never returned.

On a page used by people without IDE access, read the metadata on the server side, for example with SF.user.getUserMetadata in a process script.

With Multi, on a page where Remove VB lists from the model is off, a user selected before the latest search comes from <model>_vb: their entry in SF_input.SF_data only has email, firstName and lastName. To get the other fields of every selected user, call new Users().find({ email: { $in: SF_input.value } }).

API IntegrationDirect link to API Integration

User Search EndpointDirect link to User Search Endpoint

  • URL: /api/v1/user
  • Method: GET
  • Parameters:
    • limit: Maximum results (the widget asks for 10)
    • groups: Comma-separated group IDs for filtering
    • key: Search query string
    • SF_mode: Application mode parameter
    • onlyActive: true leaves out blocked users (sent by the widget on the current engine)

Group FilteringDirect link to Group Filtering

When groups are configured, the API request automatically includes group filters to restrict results to users belonging to the specified groups.

Best PracticesDirect link to Best Practices

Performance OptimizationDirect link to Performance Optimization

  • Use group filtering to reduce search result size
  • Consider caching frequently accessed user data

User ExperienceDirect link to User Experience

  • Provide clear placeholder text indicating the selection purpose
  • Say in the placeholder text that users can type a name or an email: the list shows 10 users at most
  • Use descriptive labels that match your use case
  • Keep the clearable option enabled for better user control
  • Choose appropriate label format (name vs email) based on context

Validation StrategyDirect link to Validation Strategy

  • Use required validation for critical selections
  • Implement conditional validation based on form context
  • Provide meaningful error messages for validation failures

AccessibilityDirect link to Accessibility

  • Ensure proper labeling for screen readers
  • Maintain keyboard navigation support
  • Use semantic HTML through Element UI components

TroubleshootingDirect link to Troubleshooting

Common IssuesDirect link to Common Issues

No Users AppearingDirect link to No Users Appearing

  • Check group filter configuration
  • Verify user API endpoint availability
  • Ensure users exist in the specified groups
  • Check that the user is not blocked: only active users are proposed

Selection Not SavingDirect link to Selection Not Saving

  • Verify model/variable name is correctly configured
  • Check for form validation errors
  • Ensure proper data binding in parent form

Performance IssuesDirect link to Performance Issues

  • Restrict the list with Groups Filter if there are too many users
  • Type part of the name or the email to find a user beyond the first 10