Skip to content

Variables and functions in MFD expression

Last updated: 2026-09-25

This topic introduces the supported variables and functions in Dromlik Message Flow Designer. Variables and functions can be referenced in expression-supported components (such as Condition) to dynamically retrieve data and control message flow logic.

Variables

There are two types of variables in Message Flow Designer:

  • Session Variables — store information about the current message session. These variables are globally accessible throughout a message flow and do not depend on any specific components.
  • Component Variables — hold the values returned by specific components. These variables become available after the corresponding components are added to a message flow.

Session Variables

VariableTypeDescriptionExample
$Session.contactNumberStringThe customer's number."15812340987"
$Session.channelNumberStringThe number of the message channel."LC00113"
$Session.contactNameStringThe full name of the contact matching the customer's number."Leo Bell"
$Session.contactFirstNameStringThe first name of the contact."Leo"
$Session.contactLastNameStringThe last name of the contact."Bell"

Component Variables

Menu component

VariableTypeDescriptionExample
$Menu{index}.receivedMessageStringThe message content the customer sends in response to the menu."1"

Wait for Reply component

VariableTypeDescriptionExample
$WaitForReply{index}.receivedMessageStringThe message content the customer replies."Transfer to a live agent."

Get Extension Presence Status component

VariableTypeDescriptionExample
$GetExtensionStatus{index}.currentProfileNameStringName of the extension's current presence status."Available"
$GetExtensionStatus{index}.currentProfileStringName and additional information of the extension's current presence status."Available,work"
$GetExtensionStatus{index}.isUnavailableBooleanWhether the extension is unregistered.False

Get Extension Info component

VariableTypeDescriptionExample
$GetExtensionInfo{index}.numberStringExtension number."1001"
$GetExtensionInfo{index}.nameStringExtension name."Phillip Huff"
$GetExtensionInfo{index}.emailStringExtension's email address."phillip@sample.com"
$GetExtensionInfo{index}.mobileNumberStringExtension's mobile number."15880123456"

Get Company Contact Info component

VariableTypeDescriptionExample
$GetCompanyContactInfo{index}.contactNameStringContact name."Leo Poll"
$GetCompanyContactInfo{index}.companyStringCompany name."YS"
$GetCompanyContactInfo{index}.emailStringEmail address."leo@ys.com"
$GetCompanyContactInfo{index}.phonebookListStringThe phonebook(s) the contact belongs to."All"
$GetCompanyContactInfo{index}.remarkStringRemark about the contact."remark"
$GetCompanyContactInfo{index}.businessStringBusiness number."01082345678"
$GetCompanyContactInfo{index}.mobileStringMobile number."13800001234"
$GetCompanyContactInfo{index}.homeStringHome number."01087654321"

Database Access component

VariableTypeDescriptionExample
$DatabaseAccess{index}.queryResultObjectThe table returned by a SQL query. Use GET_TABLE_ROW_COUNT and GET_TABLE_CELL_VALUE functions to retrieve data."demo@yeastar.com"
$DatabaseAccess{index}.nonQueryResultIntegerThe number of rows affected by a non-query SQL statement.99
$DatabaseAccess{index}.scalarResultStringThe single value returned by a scalar SQL query."10"

HTTP Request component

VariableTypeDescriptionExample
$HttpRequest{index}.responseContentStringThe body content returned from the HTTP response.{"authenticated": true}
$HttpRequest{index}.responseStatusCodeStringThe HTTP status code returned from the request."200"

Functions

Functions are used for condition evaluation and data processing, enabling flexible control of the message flow.

Boolean functions

FunctionSyntaxDescription
FX_ANDFX_AND(condition1, condition2, ...)Returns True only if all conditions are met.
FX_ORFX_OR(condition1, condition2, ...)Returns True if any condition is met.
FX_NOTFX_NOT(condition)Returns the opposite of the Boolean result.
FX_EQUALFX_EQUAL(value1, value2)Returns True if two values are equal (value and type).
FX_NOT_EQUALFX_NOT_EQUAL(value1, value2)Returns True if two values are not equal.
FX_CONTAINSFX_CONTAINS(value1, value2)Returns True if the first string contains the second string.
FX_GREATER_THANFX_GREATER_THAN(value1, value2)Returns True if the first value is greater than the second.
FX_GREATER_THAN_OR_EQUALFX_GREATER_THAN_OR_EQUAL(value1, value2)Returns True if the first value is greater than or equal to the second.
FX_LESS_THANFX_LESS_THAN(value1, value2)Returns True if the first value is less than the second.
FX_LESS_THAN_OR_EQUALFX_LESS_THAN_OR_EQUAL(value1, value2)Returns True if the first value is less than or equal to the second.
FX_TO_BOOLEANFX_TO_BOOLEAN(value)Converts a value to Boolean. Returns False for "0", "False", or null.

String functions

FunctionSyntaxDescription
FX_CONCATENATEFX_CONCATENATE(string1, string2, ...)Concatenates all string parameters and returns the result.
FX_TRIMFX_TRIM(value)Removes leading and trailing whitespace.
FX_LEFTFX_LEFT(text, count)Extracts a specified number of characters from the beginning.
FX_MIDFX_MID(text, start_position, length)Extracts a substring from a specified position with a specified length.
FX_RIGHTFX_RIGHT(text, count)Extracts a specified number of characters from the end.
FX_UPPERFX_UPPER(text)Converts all characters to uppercase.
FX_LOWERFX_LOWER(text)Converts all characters to lowercase.
FX_REPLACEFX_REPLACE(text, target, replacement)Replaces a specified substring with another substring.
FX_REPLACE_REG_EXPFX_REPLACE_REG_EXP(text, expression, replacement)Replaces substrings matching a regular expression pattern.

Integer and conversion functions

FunctionSyntaxDescription
FX_TO_INTEGERFX_TO_INTEGER(value)Converts a value to a 32-bit integer.
FX_TO_LONGFX_TO_LONG(value)Converts a value to a 64-bit integer.
FX_GET_TABLE_ROW_COUNTFX_GET_TABLE_ROW_COUNT(table)Returns the number of rows in a table result.
FX_GET_LIST_ITEM_COUNTFX_GET_LIST_ITEM_COUNT(list)Returns the number of items in a list.
FX_JSON_GET_INTEGERFX_JSON_GET_INTEGER(JSONObject, key)Retrieves an integer value from a JSON object by key.

Object functions

FunctionSyntaxDescription
FX_GET_TABLE_CELL_VALUEFX_GET_TABLE_CELL_VALUE(table, row, column)Retrieves the value from a table cell at the specified row and column.
FX_GET_LIST_ITEMFX_GET_LIST_ITEM(list, index)Retrieves the value from a list at the specified index.
FX_GET_JSON_ARRAY_ITEMFX_GET_JSON_ARRAY_ITEM(jsonData, arrayKey, index, fieldName)Retrieves a value from an object at the specified index in a JSON array.
FX_JSON_GET_OBJECTFX_JSON_GET_OBJECT(JSONObject, key)Retrieves a nested JSON object from a parent JSON object by key.

Examples

FX_AND — check multiple conditions

FX_AND(FX_EQUAL($Menu1.receivedMessage, "1"), FX_EQUAL($Session.contactNumber, "15812340987"))

Returns True only when the customer replied "1" to the menu and their number is "15812340987".

FX_CONTAINS — check if a company name matches

FX_CONTAINS($GetCompanyContactInfo1.company, "Dromlik")

Returns True if the company name contains "Dromlik".

FX_REPLACE — strip a country code

FX_REPLACE("+8613800138000", "+86", "")

Removes the country code +86 and returns "13800138000".

Next steps