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.
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.
How to use variables and constants
Constants and variables can be used in automation rules.
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.
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: