From Bright Pattern Documentation
• 日本語

Revision as of 23:53, 4 November 2026 by Wyler.metge (talk | contribs) (Updated via BpClonePage extension. Source page: draft:Workflow-builder-reference-guide/Built-InFunctions)

< Previous
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
• 日本語

Built-In Functions

The following built-in functions can be used in the Workflow Builder application.

To invoke a function from a text field, prefix it with an equal sign. Example: =length("howmanycharactersareinthisstring")

Descriptions

formatdatetime(int unixtimestamp, string format)

This function formats the time as specified in the format argument. This format is the same as in Java SimpleDateFormat, as implemented by the International Components for Unicode (ICU) library.

Example: "yyyy-MM-dd'T'HH:mm'Z'" yields 2012-07-20T20:45:44.0973928Z

formatduration(duration_in_seconds)

This function converts a duration specified in seconds into MM:SS or HHH:MM:SS format. It produces a formatted string as output (e.g., formatduration(121) will return "02:01").

hmac(hash_function, key, message)

This function is used to create an authentication hash (HMAC) for MD5, SHA-1, and SHA-256, where hash_function = ("MD5" | "SHA-1" | "SHA-256"). The returned value is a string with a base64-encoded hash.

length(string)

This function returns the number of characters in a string.

lowercase(string)

Converts all letters in a string to lowercase; the function may be used with variables.

For example:

=lowercase("AbCdEfG") will return "abcdefg"

now()

Returns a Unix timestamp (i.e., the number of seconds elapsed since 1/1/1970, 00:00:00 UTC). Prior to Bright Pattern Contact Center version 5.7.0, the "time zone" argument in now("time zone") was ignored.

parsedatetime(string datetime, string format)

This function returns the specified date and time in Unix format (number of seconds elapsed since 1/1/1970, 00:00:00 UTC). The date and time input is expected in ICU's Java SimpleDateFormat.

replace(string, search_pattern, replace_pattern, flags)

  • This function performs search and replace in the input string and returns the resulting string.
  • Parameters are as follows:
    • string is the input string to be searched.
      • Variables such as $(some_var) are expanded in place before the function is evaluated. If the value of the variable contains special symbols such as double quotes ("), it will break the function call. Escaping double quotes with a backslash (\") is not always reliable, so wrap the argument in single quotes (') instead of double quotes (e.g., replace('$(some_var)',"pattern","replacement","i")).
    • search_pattern is the regular expression pattern to be matched in the input string. Supported patterns are listed in the table below. Note the extra \ in escapes. This allows literal insertion of " and new line symbols.
    • replace_pattern is the text to insert instead of the matched text according to the search pattern. \\0 - \\9 are allowed in replacements.
    • flags denote one or more of the following additional conditions:
      • i – ignore case in the search
      • g – replace all matches (by default, only the first match is replaced) (e.g., replace("abcabc","c","z","ig") produces "abzabz").


Example that takes the first name from the fullname variable and can be used in the value section of the Set Variable block: =replace('$(fullname)',"(.*)\\s+(.*)","\\1","i")

round(floating_number, precision)

This function rounds the number to the <precision> number of digits after the decimal point. The result is still a floating point number.

stripnondigits(string)

This function removes all characters except digits 0 to 9, *, and # from a string (e.g., stripnondigits("123abc456") will return "123456").

titlecase(string)

This function converts a string to title case (i.e., each word is capitalized).

tostring(integer)

This function converts an integer to a string (e.g., tostring(-2+1) returns "-1").

uppercase(string)

Converts all letters in a string to uppercase; the function may be used with variables.

For example:

Where "$(item.from)" = "user_name", =uppercase('$(item.from)') will return "USER_NAME"

urlencode(string)

URL-encodes a string, replacing special characters using the %dd notation. This conservative implementation replaces all characters that are not explicitly allowed.


Pattern Types

Pattern types are described as follows.


Pattern Description
^ Match beginning of a buffer
$ Match end of a buffer
() Grouping and substring capturing
[…] Match any character from the set
[^…] Match any character but the ones from the set
\\s Match whitespace
\\S Match non-whitespace
\\d Match decimal digit
\\D Match anything but decimal digit
\\r Match carriage return
\\n Match new line
+ Match one or more times (greedy)
+? Match one or more times (non-greedy)
* Match zero or more times (greedy)
*? Match zero or more times (non-greedy)
? Match zero times or once
\\<meta> Match a meta character literally, where <meta> is one of the following: ^$().[*+?\


<Previous
< Previous