Skip to navigation

MWDSL & Bender

View as Markdown

Two mini-languages appear throughout the Configuration API: MWDSL (fields ending _dsl — access rules, filters, enablement toggles) and Bender (fields named *_bender — data mappings). Both are validated at write time.

MWDSL

An expression language evaluated against a payload (for most config fields: the requesting user).

Operators (decreasing precedence): () · . [] accessors · * / · + - · == != > >= < <= IN NOT IN · NOT · AND · OR · IF … THEN … ELSE …. Keywords are case-insensitive.

Literals: "text", 123, 2.5, TRUE/FALSE/NULL, [a, b], {"k": v}.

Attributes: bare identifiers resolved against the payload — user.email_addr, user.department, user.manager, user.user_tags, user.custom_data.<your attribute>. Negative indices and slices work: items[-1], text[0:5].

Functions: $NAME(args) or postfix value.$NAME(args). Catalog: $LOWERCASE $UPPERCASE $TRIM $CONCAT $SPLIT $REPLACE $STARTS_WITH $ENDS_WITH $MATCH (regex) $MAP $FILTER $ANY $ALL $FIND $REDUCE $LENGTH $COALESCE $TIME $PARSE_TIME $FORMAT_TIME $ADD_DATE $TEXT $INTEGER $DECIMAL $PARSE_JSON $URLENCODE … Lambdas as function args: x => expr.

There is no $CONTAINS — use the IN operator ("sub" IN text = substring, item IN list = membership). Regex = $MATCH.

Semantics: "", 0, NULL, FALSE, [], {} are falsy. AND/OR short-circuit and return a value. "true" = enabled for everyone; "false" = disabled.

Examples

true
user.department == "IT"
user.email_addr IN ["a@acme.com", "b@acme.com"]
user.department IN ["IT", "Engineering"] AND NOT user.is_anonymous_user
user.manager_email.$LOWERCASE() == "boss@acme.com"
"TESTER" IN user.user_tags
user.email_addr.$ENDS_WITH("@acme.com")
IF user.vip THEN "true" ELSE "false"

Bender (short form)

A JSON data-mapping language. Three rules:

  1. A bare string is an MWDSL expression — so string constants must be quoted inside it: {"entity_type": "\"PERSON\""}.
  2. A JSON object maps output keys (dotted nested paths allowed) to sub-benders; a JSON array builds a list.
  3. Function calls are single-key objects with an UPPERCASE FUNC() key: EVAL() FLATTEN() MERGE() MAP() SORT() COALESCE() FILTER() CONDITIONAL() LOOKUP() CONCAT() RENDER() STRIP_HTML().

Examples

Simple mapping (e.g. live-agent url_params_bender):

{"user": "user.email_addr", "ticket": "ticket.id"}

Lookup + loop (MAP() exposes the loop value as item):

{
"group_owners": {"MAP()": {"converter": {"email": "item"}, "items": "ManagedBy"}},
"status": {"LOOKUP()": {"key": "work_status",
"mapping": {"FULL_TIME": "\"FULL_TIME\""},
"default": "\"OTHER\""}}
}

Conditional with fallback:

{"prop": {"COALESCE()": [
{"CONDITIONAL()": {"condition": "val == 1", "on_pass": "\"A\"", "on_fail": "NULL"}},
"\"B\""]}}

dl_group_validation_bender in Group Access Settings takes the long form only. For example, to pass the group name through: {"object": {"children": {"name": {"simple_eval": {"expression": {"rule_v2": "group.name"}}}}}}. Every other Data Mapper field accepts the short form shown above.