Skip to main content
Version: 2.4

JEXL Runtime And Public API

Runtime Calls: Helpers, Data Sources, And Public API

JEXL expressions can call three kinds of runtime functionality.

KindExamplesUse for
In-memory helpersisNullOrEmpty, includes, dateFormat, sumManyCheap formatting, checks, array mapping, calculations.
Runtime/data-source helpersevalScriptByCode, attachmentCount, tsmModule, datePlusWorkdaysCalls that read another runtime service or configured script.
Public API entity callscrm.customer.get(...), order.order.find(...), user.user.get(...)Direct entity reads from tSM Public API.

Prefer in-memory helpers inside frequently recalculated UI properties. Guard runtime and API calls with a condition so they do not run when required input is missing:

!isNullOrEmpty($context.form.customerId)
? crm.customer.get($context.form.customerId)
: null

Public API Calls

JEXL can call tSM Public API using this form:

<service>.<entity>.<method>(arguments...)

Examples:

crm.customer.get($context.form.customerId)
crm.customer.find({ code: $context.form.customerCode })
config.registerValue.get($context.entity.statusId, { expand: ['REGISTER'] })

Segments:

SegmentExampleMeaning
servicecrmMicroservice or logical API area.
entitycustomerEntity in the service.
methodget, findOperation on the entity.

Every call can trigger an HTTP request. The platform can cache results, but UI expressions must still be designed with latency in mind. Avoid placing Public API calls into expressions that are evaluated repeatedly during every small field change unless it is necessary.

Public API Filter Operators

Filters use suffixes on field names:

crm.account.find({ code__in: $context.form.accountCodes })
ticket.ticket.find({ createdAt__gte: $context.form.dateFrom })

Supported suffixes:

SuffixMeaningExample
__containscontains value{ name__contains: 'slovanet' }
__notcontainsdoes not contain value{ name__notcontains: 'test' }
__startswithstarts with value{ code__startswith: 'BA' }
__endswithends with value{ code__endswith: '01' }
__invalue is in list{ code__in: ['A', 'B'] }
__notinvalue is not in list{ code__notin: ['A', 'B'] }
__eqequals{ status__eq: 'ACTIVE' }
__noteqdoes not equal{ status__noteq: 'CANCELLED' }
__gtgreater than{ amount__gt: 10 }
__gtegreater than or equal{ amount__gte: 10 }
__ltless than{ amount__lt: 10 }
__lteless than or equal{ amount__lte: 10 }
__emptyempty value{ field__empty: true }
__notemptynon-empty value{ field__notempty: true }
__btwbetween values{ amount__btw: '10-15' }
__gtrgreater than relative time{ date__gtr: '-1d' }
__ltrless than relative time{ date__ltr: '+1d' }
__btwrbetween relative times{ date__btwr: '-1d:+1d' }
__dontTouchleave value untouched{ field__dontTouch: 'customFunction()' }
__fuzzyContainsfuzzy contains for Elastic/TQL cases{ name__fuzzyContains: 'slovanet' }

JEXL vs SpEL

JEXL and SpEL solve different problems in tSM.

TopicJEXLSpEL
RuntimeFrontend/UI runtime.Backend/server runtime.
Typical placeForms, widgets, data-source parameters, UI validations.Processes, scripts, automation, backend orchestration.
Context style$context, $value, $row, $configUi.#variables, #context, Spring beans/services.
Expression shapeUsually one expression returning a value.Can be a longer script-like expression with assignments and service calls.
Side effectsAvoid side effects; UI expressions can re-evaluate often.Side effects are expected in process/script logic when intentionally designed.
TransactionsNo backend transaction boundary.Can run as part of backend process/script execution.
Best useVisibility, required state, default values, filters, small transformations.Persisting changes, process transitions, integration logic, complex business rules.

Rule of thumb: if the expression only decides how the current UI behaves, use JEXL. If it changes server-side state, coordinates multiple entities, or has integration side effects, use SpEL or a backend script and call it from JEXL only when needed.