WFM Conditional Selector

From 3B Knowledge
Jump to navigation Jump to search

Overview

The WFM Conditional Selector system enables flexible, metadata-driven conditional logic that governs rendering and interactivity across various components in the WFM product. Selectors are most commonly used to control visibility and access for UI elements and actions, such as:

  • Scheduler actions: e.g canEdit, canCancel, canDelete, canCreate
  • Field visibility: showIf
  • Field options: showOptionIf
  • Approval flows and form rendering logic

Selectors provide a declarative way to evaluate record context, user relationships, or system state, enabling dynamic control without code.

Structure

Selectors are defined within a condition object and can be composed of one or more field-based evaluations.

"showOptionIf": {
  "condition": {
    "allOrSome": "all",
    "selectors": [
      {
        "field": "b3s__Contact__c",
        "operator": "equals",
        "targetField": "b3o__Candidate__c"
      },
      {
        "field": "b3s__Job__c",
        "operator": "equals",
        "targetField": "b3o__Job__c"
      }
    ]
  }
}

Condition Properties

allOrSome

Specifies how the list of selectors should be evaluated:

  • "all" – All selectors must evaluate to true for the condition to pass
  • "some" – At least one selector must evaluate to true for the condition to pass

selectors

An array of individual selector objects. Each selector performs a field-based evaluation based on the current context.

Selector Object Properties

Property Type Description
field string Path to the field to be evaluated (can include dot notation)
operator string Comparison operator (see Operators)
value any (Optional) A value to compare against, used with equals, notequals, in, isnull
targetField string (Optional) Field path used to dynamically compare values between two fields

Either value or targetField must be present, depending on the operator used.

Supported Operators

Operator Description Example
equals Compares if two values are equal "value": "Rejected"
notequals Compares if two values are not equal "value": "Approved"
isnull Evaluates whether the field is null or not (requires boolean) "value": true
in Evaluates whether field value is in an array of values "value": ["A", "B", "C"]

Static States: Simple Boolean or Null

Selectors can also be defined as a direct boolean or null:

Value Meaning
true Always allow
false Always prevent
null Treated as true (default/fallback)

Notes & Best Practices

  • field and targetField should always be valid field paths in your Salesforce data model.
  • Ensure data types align when using equals, notequals, or in. For example, comparing a string to a lookup ID.
  • Avoid mixing incompatible operators in the same selector block (e.g., in with targetField).
  • When using isnull, the value must be explicitly true or false.

Summary

The Conditional Selector system provides a powerful mechanism to declaratively control access, visibility, and behavior in the WFM platform. Through the use of selectors, administrators can:

  • Adapt UI behavior based on record data
  • Ensure correct permissions without code
  • Provide a dynamic experience tailored to user and record context

Selectors offer an expressive yet compact syntax for building complex conditional logic that adapts to your business rules and data structure.