top_en
Main page

Bitrix24Care

Using expressions in activity parameters

Rating:

To deliver maximum flexibility, the activity parameters allow the use of special expressions whose values are calculated at run time. To specify that a parameter value is an expression, use the Excel-like notation that is, start the value with an "equals" sign: =. In other words: an expression is anything that is prepended with an equals sign.

Examples:

=6^2 + {=Document:PROPERTY_NUM}/2

=if({Document:ID}=5, "text1", "text2")

A parameter can use only one expression. To use multiple expressions in a parameter, use the concatenation operator (&), and enclose text in the expressions in double quotes (") as needed.

Examples:

="Reply:" & (1+3)

="Author: " & {=Document:CREATED_BY} & ", " & "Deadline: " & Dateadd({=Document:DATE_CREATE}, "1d")

As you will see below, the syntax of operators and functions in expressions is largely based on the syntax of those in PHP.

The following operators and functions are possible.

  • + - adds two values;
  • - - subtracts the second value from the first one;
  • * - multiplies two values;
  • / - divides the first value by the second one;
  • = - assigns (i.e. returns) the expression result;
  • <> - not equal;
  • < - less than;
  • > - more than;
  • <= - less than or equal;
  • >= - more than or equal;
  • () - round brackets;
  • & - concatenation operator. Return a new string which is the left string plus the right string;
  • ^ - power;
  • % - percent;
  • true - Boolean true;
  • false - Boolean false;
  • and - Boolean AND;
  • or - Boolean OR;
  • not - Boolean NOT;
  • min - returns the minimum of the two values;
  • abs - returns the absolute value of an argument;
  • dateadd - adds the time span passed as the second argument to the date specified as the first argument.

    Syntax:

    =dateadd([initial date], [time span])

    The following units are possible in the time span: yyearyearsmmonthmonthsddaydays
    hhourhoursiminminuteminutesssecondseconds. The units are case insensitive.

    Examples:

    =Dateadd({=Document:DATE_CREATE}, "-2d")

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

  • datediff - Returns the difference between two dates.

    Syntax:

    =datediff([date1], [date2], [difference_display_format]);

    The difference can be displayed in various units.

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

  • if - specifies a condition;

    Syntax:

    =if([condition], [expression if true], [expression if false])

    Example:

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

  • intval - returns the integer of the value passed as the parameter;

    Example:

    =intval("234j4hv5jhv43v53jk4vt5hj4") returns 234 because the value starts with this number, and the character immediately following the "4" is not a number.

  • substr - returns the portion of a string as specified by the last two parameters. See http://www.php.net/manual/en/function.substr.php for details.

Attention! If an expression has an error, it will not be evaluated and will be displayed as text.


Please note that all consultations and assistance with business process setup are provided exclusively by local Bitrix24 partners.
This helped Thanks :) This didn't help Sorry :(
Could you please tell us why:
It's not what I'm looking for
It's too complicated

Did not find an answer to your question?

Send your question to the Bitrix24Care team
Access to technical support specialists requires commercial plan subscription and is not available to free account users. Free accounts are limited to self-support resources such as product manuals, helpdesk articles, video tutorials, and free webinars. Technical assistance, training, setup, customization and other value added services can also be purchased directly from local Bitrix24 partners