Bitrix24 Helpdesk

Expressions in activity parameters

Expressions let you perform calculations and apply logic in activity parameters. You can use math operations, conditions, dates, and text functions.

To create an expression, start the value with the equals sign =.

Examples:

=6^2 + {=Document:PROPERTY_NUM}/2
=if({Document:ID}=5, "text1", "text2")

You can use multiple calculations in one field and combine calculations with text.


Combine calculations with text

Option 1: Insert a calculation into text

Wrap the expression in {{=...}}.

Example

You need to execute the documents before {{=DateAdd({=Document:CREATED}, '5d')}}

Option 2: Join text and values

Use the & operator and place text in quotation marks.

Examples:

="Reply:" & (1+3)
="Author: " & {=Document:CREATED_BY} & ", Deadline: " & DateAdd({=Document:DATE_CREATE}, "1d")
Expression syntax is similar to PHP functions.

Operators

Use operators to perform calculations or comparisons.

Operator Description
+ Add values
- Subtract values
* Multiply values
/ Divide values
= Equal
<> Not equal
< Less than
> Greater than
<= Less than or equal
>= Greater than or equal
() Group operations
& Combine text values
String Operators
^ Exponentiation
% Percentage
true Logical true
false Logical false
and Logical AND
or Logical OR
not Logical NOT

Example:

=if(or({=Variable:aaa}>2, {=Variable:bbb}<10), "yes", "no")

Calculation functions

Use functions to process numbers, text, dates, and arrays. Enter = in a field to see the list of available functions.

Functions and examples

Function Description
abs

Returns the absolute value of a number.

Works the same as the PHP abs() function.

dateadd

Adds a specific amount of time to a date.

Syntax: =dateadd(start_date, value)

Supported time units:

  • y, year, years
  • m, month, months
  • d, day, days
  • h, hour, hours
  • min, minute, minutes
  • s, second, seconds

You can use upper or lower case.

Examples:
=Dateadd({=Document:DATE_CREATE}, "-2d")
=Dateadd({=Document:DATE_CREATE}, "2 days 3 minutes")

If the value is stored in a field, use the concatenation operator &:

=DateAdd({=Document:DATE_CREATE}, {=Variable:WHAT2ADD} & "y 10h")
datediff

Returns the difference between two dates.

Syntax: =datediff(first_date, second_date, format)

You can specify the result format.

Example: =datediff({=Variable:Variable1}, {=Variable:Variable2},'%m month, %d days')
date

Formats a date.

Works the same as the PHP date() function.

Syntax: =date("format", date)

WorkDateAdd

Adds working time to a date based on your company calendar.

Syntax: =WorkDateAdd(start_date, value)

Supported time units:

  • d, day, days
  • h, hour, hours
  • i, min, minute, minutes

You can use upper or lower case.

Example: =WorkDateAdd({=Template:Parameter1}, "2d")
If Parameter1 is 28.04.2016 and April 30–May 1 are weekends, the result is: 02.05.2016 09:00:00.

  • May 2 is the next working day after the weekend.
  • 09:00:00 is the default start of the workday.

Working days and hours are configured in Bitrix24 settings.

AddWorkDays

Adds working days to a date.

Syntax: =addworkdays(date, number_of_days)

Examples:

{{=addworkdays("03.07.2024", 1)}}05.03.2024 00:00:00
July 4 is a non-working day in the account calendar.

{{=addworkdays("05.02.2016 16:14:00", 1)}}08.02.2016 16:14:00
February 5 is a Friday, so the next working day is Monday.

isWorkDay

Checks whether a date is a working day.

Syntax: =if(isWorkDay(date), value_if_true, value_if_false)

Example: {{=if(isWorkDay({=Template:Parameter1}), "Yes", "No")}}
If Parameter1 is 28.04.2016, the result is Yes because April 28 is a working day.
isWorkTime

Checks whether a date and time fall within working hours.

Syntax: =if(isWorkTime(datetime), value_if_true, value_if_false).

Example: {{=if(isWorkTime({=Template:Parameter1}), "Yes", "No")}}
If Parameter1 is 27.04.2016 15:00:00, the result is Yes because that time falls within working hours.
toUserDate

Converts a date and time to the user's time zone.

Syntax: toUserDate(user, date=now)

Parameters:

  • user — user whose time zone is applied
  • date — date and time to convert (optional)
GetUserDateOffset

Returns the difference between the user's time zone and server time in seconds.

Syntax: GetUserDateOffset(user)

Parameter:

  • user — user whose time zone is applied
getdocumenturl

Returns a link to the current document.

Syntax: {{=getdocumenturl(format, full_link)}}

Parameters:

Link format

  • 'bb' — returns the link in BBCode format, for example: [url=link]Document Title[/url]
  • 'html' — returns the link in HTML format, for example: <a href="link">Link Text</a>

Full link

If set to true, the link includes the full domain, for example: https://example.com/...

Examples:

BBCode format:
{{=getdocumenturl('bb')}}

HTML format with full domain:
{{=getdocumenturl('html', true())}}

responsible Returns a date or date and time in the assignee’s time zone. Supports Date and Date/Time fields.

Syntax: {=Variable > responsible}

Example: {{=Document:DEADLINE > responsible}}

If the Deadline field contains 03/15/2026 10:00, the value is converted to the assignee’s time zone.

Result: The date and time are displayed in the assignee’s local time.
if

Returns one value if the condition is true and another if it is false.

Syntax: =if(condition, value_if_true, value_if_false)

Example: =if({=Variable:Variable1_printable}>0, "yes", "no")

You can compare values of different types, as long as they follow the supported type conversion rules.
Insert Value Form

If you pass a multiple field (array) to the if function, an empty array is treated as an empty value. This lets you check whether a field contains any values without using additional functions.

Example: {{=if({=Bind to user multiple}, "Empty", "Not empty")}}

If the Bind to user multiple field is empty, the result is "Empty".

If the field contains at least one value, the result is "Not empty".
intval Converts a value to an integer.
Example: =intval("234j4hv5jhv43v53jk4vt5hj4")234
floatval Converts a value to a decimal number.
numberformat

Formats numbers to make them easier to read.

  • Adds spaces between thousands, for example 1 000 000 instead of 1000000
  • UUses a comma as the decimal separator, for example 123,45 instead of 123.45

Example: {{=numberformat(2500000.75; 2; ","; " ")}}2 500 000,75

min Returns the smallest value.
max Returns the largest value.
rand Returns a random number.

Syntax: =rand(min, max).

The maximum value is optional.

Example: =rand(0,10) returns a random value between 0 and 10.
round Rounds a number.

Syntax: =round(value, decimals)

Examples:

  • =round(10/3,2)3.33
  • =round(5/2)3
ceil Rounds a number up.
Example: =ceil(5.5)6
floor Rounds a number down.
Example: =floor(5.5)5.
substr

Returns part of a string.


PHP substr() function

Syntax: substr(text, start, length)

Indexing starts at 0. For example, in the string 'abcdef', position 0 is 'a', position 2 is 'c'.

Example: {{=substr("0123456789", 3, 4)}}3456

If the expression contains an error, it is displayed as plain text.
strpos Returns the position of the first occurrence of a substring.
strlen Returns the length of a string.
implode

Combines multiple values into one string using a custom separator.

Works like PHP's implode().

Syntax: implode(glue, pieces)

Parameters:

  • glue — text inserted between values. If not specified, an empty string is used.
  • pieces — array of values to combine.

The function returns a single string with all values joined in the specified order.

explode

Splits a string into multiple values.

Works like PHP's explode().

Syntax: explode(delimiter, string)

Parameters:

  • delimiter — character or text used to split the string
  • str — text to split

The function returns an array of values created from the original string.

randstring Returns a random string.
merge Combines arrays.

Syntax: =merge(array1, array2)

Example: =merge({=Document:FILES}, {=Variable:file})
urlencode Encodes text for use in URLs.
strtolower Converts text to lowercase.
strtoupper Converts text to uppercase.
ucwords Capitalizes the first letter of each word.
firstvalue Returns the first value from a multiple field.
swirl

Moves the first value in a multiple field to the end of the list.

The values shift one position to the left, and the first value becomes the last.

shuffle

Randomizes the order of values in a multiple field.

Works like PHP's shuffle().

The function returns the same values in a random order.

You can use shuffle, firstvalue, and swirl together to assign a task randomly.

The workflow includes a multiple variable called Users, which stores a list of employees.

  1. Use shuffle to randomize the list of users.
  2. Use firstvalue to select the first user in the list. This user becomes the assignee.
  3. Use swirl to move the first user to the end of the list.
  4. Use firstvalue again to select another user. This user becomes the participant.

After the workflow runs, the task is assigned randomly to one user, and another user is added as a participant.

settime

Sets a specific time for a date.

Syntax: {{=settime(date, hours, minutes)}}

Examples:

  • Set a specific time:
    {{=settime(03.12.2023, 15, 55)}}03.12.2023 15:55:00

  • Automatic time adjustment:
    {{=settime(03.12.2023, 21, 79)}}03.12.2023 22:19:00

If the number of minutes exceeds 59, the function automatically converts the extra minutes into hours.

trim

Removes spaces at the beginning and end of text.

Syntax: {{=trim(text)}}

Example: If Variable1 contains " 123 " (with spaces):
{{=trim(Variable1)}}"123"

Go to Bitrix24
Don't have an account? Create for free