Read FAQ
NEW
Bitrix24 Support
Registration and Authentication
How to start
My Profile
Feed
Chats and Calls
Calendar
Bitrix24.Docs
Bitrix24.Drive
Bitrix24.Mail
Workgroups
Tasks and Projects
CRM
CoPilot - AI in Bitrix24
Contact Center
Sales Center
CRM Analytics (beta)
BI Builder
Sales Intelligence
Inventory Management
Marketing
Sites
Online Store (beta)
CRM + Online Store
CRM Store (beta)
Bitrix24.Sign
Company
Knowledge base (beta)
Automation
Workflows
Telephony
Market
Subscription
Settings
Enterprise
Mobile App
Desktop App
General questions
Bitrix24 On-Premise

Bitrix24Care

Variables and constants in automation rules

Variables and Constants in CRM greatly simplify calculations in fields and work scenarios, such as profit calculation.

Constants are values that do not change or change rarely. It can be a tax rate, a specific date, an employee's role, and so on. For example, you can create a "Chief Accountant" constant and assign this role to a specific employee. If the chief accountant is changed, you should change the value of the constant and select another employee. All automation rules that use this constant will automatically use the new value.

Variables are values that can change during the work process. For example, a variable could be the percentage from the deal that managers receive. Depending on the amount of the deal, the managers will receive different percentages.


Create variables and constants

Go to the Automation rules page.

Select Variables or Constants on the top panel.

The constant value can only be changed manually by editing the item. A variable can also be changed by the Variable change automation rule.

Edit variable and Math operations

You will see a table with a list of items. If necessary, you can select fields to be displayed. Click on the settings icon.

Constants and variables are created in the same way. Let's consider the settings on the example of a variable.

Click Create and fill in the field values in the slider.

  • Name - it is displayed in the list. You can quickly find the desired variable by name.

  • Type - select the type of variable from the list: number, string, bind to user, etc.

  • Multiple - select how many values a variable can have: one or more.

  • Value - it depends on the type of the variable. If the type is "Number", specify a specific number.

  • Visibility - select where you can use the variable.

    Everywhere - in CRM entities, smart processes, workflows, tasks.

    CRM - in any CRM entities.

    Specific CRM entity - the variable will be available only in the selected CRM entity, for example only in deals.

  • Description - specify the purpose of the variable.

When you have filled in all the fields, click Save.

Once a constant or a variable has been created, you cannot change the values of the Type, Multiple, and Visibility fields. If you need to add other values for these fields, create a new constant or variable.

How to use variables and constants

Constants and variables can be used in automation rules.

Items will be displayed only in the sections to which they are attached.
If the Visibility field is set to CRM, the variables and constants will not be displayed in tasks. If it is set to Leads, the variables and constants will not be displayed in deals.

Example of using constants and variables in automation rules

For example, we have a warehouse in Boston. After the client makes an order in our online store, we send an email with the information about the approximate delivery time. The order picking at the warehouse never takes more than 1 day. However, the order delivery period is different: within the city, the delivery is done within 1 day, but it can take up to 3 days to deliver an order across the region.

Thus, we can specify the order picking as a constant, and the order delivery as a variable. Their default value will be 1 day.

In the Picking and shipping stage we add the following automation rules:

We use both Perform math operations automation rules to calculate the number of days required to deliver an order in the city and region. The calculated value will be saved to the Order shipping variable.

If the delivery is done within the city, we add 1 day to the order-picking period.

In the same way, we add 3 days in case of the delivery across the region.

Then we can use the Order shipping variable in the text of an email in the Send email to customer automation rule.

It is important to enable the after the previous automation rule option as it is required to calculate the value of the variable before sending an email.

The variable will be replaced by the calculated number of days, and our client will be aware of the approximate delivery time.

In brief:

  • You can use constants and variables in automation rules to store data.

  • Constants are values that do not change or change rarely. It can be a tax rate, a specific date, an employee's role, and so on.

  • Variables are values that can change during the work process.

  • Values of constants and variables can be used in mathematical operations.

  • The constant value can only be changed manually by editing the item. A variable can also be changed by the Variable change automation rule.

Read also:

Was this information helpful?
Integration specialist assistance
That's not what I'm looking for
Complicated and incomprehensible text
The information is outdated
It's too short. I need more information
I don't like the way this tool works
Go to Bitrix24
Don't have an account? Create for free