Skip to main content
Version: 2.5

Function Reference

This section lists the non-entity JEXL helper functions currently available in tSM configuration. Entity calls such as crm.customer.find(...) are covered separately in the Public API section.

Pipe Transforms​

Pipe transforms use the value on the left side of | as the first argument.

value | transformName

Use them for short display or serialization transformations. When a transformation can throw, guard the input first.

translate​

Translates a translation key through the frontend translation service.

'common.save' | translate

Practical usage:

($context.form.installationMethod == 'self'
? 'order.installation.self'
: 'order.installation.technician') | translate

Use this when a configured expression must return localized UI text. Do not use it for stable business codes or API parameters.

json​

Serializes an object or array to JSON text.

{ product: $context.form.productInternet.code, price: $context.form.productInternet.recurring.amount } | json

This is mainly useful in debugging, preview fields, or technical display fields where the user needs to see the complete object shape.

jsonParse​

Parses a JSON string into an object or array.

'{"code":"Internet","active":true}' | jsonParse

Example with guarded form input:

$context.form.rawJson
? ($context.form.rawJson | jsonParse).code
: null

Invalid JSON throws an error. Use jsonParse only when the value is known to be valid JSON or when the field is controlled by configuration.

Utilities And Current Context​

getUuid()​

Generates a new UUID.

getUuid()

Do not use it as a stable identifier in an expression that can be re-evaluated repeatedly. Each evaluation can produce a new value.

currentUserId()​

Returns the ID of the currently logged-in user.

currentUserId()

Use case:

createObject('assignee.id', currentUserId())

currentOrganizationId()​

Returns the current organization ID.

currentOrganizationId()

Use case:

createObject('organization.id', currentOrganizationId())

configUi(attribute)​

Reads a value from UI configuration.

configUi('url')

Use it when a configured UI attribute is needed inside an expression.

getLocationOrigin()​

Returns the origin of the current browser URL.

getLocationOrigin()
// for example 'https://iss-dev.slovanet'

getLocationHref()​

Returns the full current browser URL.

getLocationHref()

getLocationHost()​

Returns the host part of the current browser URL.

getLocationHost()
// for example 'iss-dev.slovanet'

hasPriv(priv)​

Returns whether the current user has a given privilege.

hasPriv('Tick.Ticket.View')

Use it for UI visibility or readonly logic that depends on privileges.

hasPolicy(policyName, params)​

Evaluates a named policy with parameters.

hasPolicy('ticketDefaultPolicy', [$context.ticket])

Use it when access depends on a policy and not just a single privilege or role.

hasRole(roleCode)​

Returns whether the current user has a role.

hasRole('Admin')

Use it for role-based UI logic.

attachmentCount(ownerId, ownerType)​

Returns the number of attachments for an owner.

attachmentCount($context.entity.id, 'Ticket')

Typical ownerType values depend on the entity area, for example 'Ticket'.

attachmentCountTypes(ownerId, ownerType)​

Returns attachment counts grouped by attachment type.

attachmentCountTypes($context.entity.id, 'Ticket')

The result is an object where keys are attachment type identifiers and values are counts.

evalScriptById(scriptId, scriptData?, disableCache = false, disableToast = false)​

Evaluates a script by script ID.

evalScriptById(
'9d1548e7-26df-4ec2-8931-b86581b21672',
{ parameter: $value.text }
)

Use this for configured script-backed data sources. Be careful with side effects and repeated evaluation.

evalScriptByCode(scriptCode, scriptData?, disableCache = false)​

Evaluates a script by script code.

evalScriptByCode('myScriptCode', { parameter: $value.text })

Use this when the script is referenced by stable code instead of ID. Be careful with side effects and repeated evaluation.

tsmModule(id)​

Loads a tSM module by ID.

tsmModule('9d1548e7-26df-4ec2-8931-b86581b21672')

The result is an identified pack containing the module data.

findProblemAllowedValues(ticket)​

Returns allowed problem values for a ticket. If the ticket category has category-specific values, those are used; otherwise the function falls back to the general problem values from the ticket type registry.

findProblemAllowedValues($context.ticket)

findResolutionAllowedValues(ticket)​

Returns allowed resolution values for a ticket. If the ticket category has category-specific values, those are used; otherwise the function falls back to the general resolution values from the ticket type registry.

findResolutionAllowedValues($context.ticket)

toISOString(value)​

Converts a value to an ISO string.

Behavior:

  • falsy value returns null,
  • string is returned unchanged,
  • object with .toISOString() is converted through that method.
toISOString($context.form.validFrom)

If you already have a string and want to keep it unchanged, this function is safer than toIso.

Checks whether a ticket has a link of a specific type and direction. It expects an array of objects with a typeAndDirection property.

ticketLinks($context.entity.links, 'PARENT_OUT')

Behavior:

  • null or empty array -> null,
  • matching link found -> true,
  • no matching link -> false.