A dataset contains information about leads, deals, companies, and other Bitrix24 items. Each item has several datasets that automatically receive data from system and custom fields. Use datasets to create charts and analyze business metrics.
In this article, you'll learn about datasets for activities, stages, and CRM item links, how to merge them, and how to create charts.
Datasets:
- crm_activity — activities in CRM items
- crm_activity_relation — CRM activity associations
- crm_lead_contact — lead-contact links
- crm_deal_contact — deal-contact links
- crm_quote_contact — estimate-contact links
- crm_contact_company — contact-company
- crm_entity_contact — SPA item-contact links
- crm_stages — CRM stages
- crm_last_communication — latest communication data for a CRM item
Examples:
Choose a dataset
To analyze information in a dashboard, choose a suitable dataset and create a chart.
crm_activity — activities in CRM items. This dataset contains data from activity system fields. Use this dataset to see activity names, types, deadlines, and responsible persons.
crm_activity
| Field | Description | Data type |
|---|---|---|
| ID | Activity ID | Number |
| SUBJECT | Activity name | String |
| ASSOCIATED_ENTITY_ID | ID of the linked item on the Bitrix24 account, for example a task | Number |
| TYPE_ID | Activity type code: 1 — "Meeting", 2 — "Call", 3 — "Task", 4 — "Email", 5 — "Activity", 6 — "User action" | Number |
| PROVIDER_ID | Activity provider code, for example CRM_WEBFORM for a CRM form | String |
| PROVIDER_TYPE_ID | Activity provider type code, for example the ID of a submitted CRM form | String |
| TYPE_NAME | Activity type name | String |
| OWNER_ID | ID of the CRM item the activity belongs to | Number |
| OWNER_TYPE_ID | CRM item type code, for example: 1 — "Lead", 2 — "Deal", 3 — "Contact", 4 — "Company" | Number |
| OWNER_TYPE_NAME | Name of the CRM item type the activity belongs to | String |
| PRIORITY_ID | Priority code: 1 — "Low", 2 — "Normal", 3 — "High" | Number |
| PRIORITY_NAME | Activity priority | String |
| DIRECTION_ID | Activity direction code: 1 — "Incoming", 2 — "Outgoing" | Number |
| DIRECTION_NAME | Activity direction name | String |
| STATUS_ID | Status code: 1 — "Pending", 2 — "Completed", 3 — "Completed automatically" | Number |
| STATUS_NAME | Activity status name | String |
| COMPLETED |
Shows whether the activity is completed: Y — yes, N — no
|
String |
| DATE_CREATE | Activity creation date and time | Date and time |
| START_TIME | Activity start date and time | Date and time |
| END_TIME | Activity end date and time | Date and time |
| DEADLINE | Activity deadline | Date and time |
| IS_OVERDUE |
Shows whether the activity is overdue: Y — yes, N — no
|
String |
| DATE_MODIFY | Date and time of the last activity change | Date and time |
| AUTHOR | ID and name of the employee who created the activity | String |
| AUTHOR_ID | ID of the employee who created the activity | Number |
| AUTHOR_NAME | Name of the employee who created the activity | String |
| EDITOR | ID and name of the employee who last modified the activity | String |
| EDITOR_ID | ID of the employee who last modified the activity | Number |
| EDITOR_NAME | Name of the employee who last modified the activity | String |
| RESPONSIBLE | ID and name of the person responsible for the activity | String |
| RESPONSIBLE_ID | ID of the person responsible for the activity | Number |
| RESPONSIBLE_NAME | Name of the person responsible for the activity | String |
| DESCRIPTION | Activity description | String |
| DESCRIPTION_TYPE_ID | Description type code | Number |
| DESCRIPTION_TYPE_NAME | Description type | String |
| ORIGINATOR_ID | External system ID | String |
| ORIGIN_ID | Item ID in the external system | String |
Some activities are labeled as user actions. For example, a task may have the activity type "User action" (TYPE_ID=6). To identify the exact type, use the PROVIDER_ID and PROVIDER_TYPE_ID fields. These fields show the category for a specific activity in CRM.
Possible PROVIDER_ID and PROVIDER_TYPE_ID values
| Field | PROVIDER_ID | PROVIDER_TYPE_ID |
|---|---|---|
| Activity | CRM_TODO | TODO |
| Meeting | CRM_MEETING | MEETING |
| Task | TASKS | TASK |
| Call | VOXIMPLANT_CALL | CALL |
| Call list | CALL_LIST | CALL_LIST |
| CRM_EMAIL | EMAIL, EMAIL_COMPRESSED | |
| SMS message | CRM_SMS | SMS |
| WhatsApp message | CRM_WHATSAPP | |
| Telegram message | CRM_TELEGRAM | TELEGRAM |
| WhatsApp message via Sales center | CRM_NOTIFICATION | NOTIFICATION, SALESCENTER_PAYMENT_SENT |
| Open Channel chat | IMOPENLINES_SESSION | Open Channel session ID |
| Submitted CRM form | CRM_WEBFORM | ID of the submitted form |
| Feed message or comment | CRM_LF_MESSAGE | LOG_ENTRY, LOG_COMMENT |
| Activity added through an external channel | CRM_EXTERNAL_CHANNEL | ACTIVITY (outdated) |
| Assignment from a workflow | CRM_REQUEST | REQUEST |
| Activity added through REST | REST_APP | Value registered through REST |
| Delivery | CRM_DELIVERY | DELIVERY |
| Call tracking call | CRM_CALL_TRACKER | CALL_TRACKER |
| Inventory document | STORE_DOCUMENT | STORE_DOCUMENT_PRODUCT, STORE_DOCUMENT_SERVICE |
| Document for signing | CRM_SIGN_DOCUMENT | SIGN_DOCUMENT |
| HR document signing activity | CRM_SIGN_B2E_DOCUMENT | SIGN_B2E_DOCUMENT |
| Payment | CRM_PAYMENT | PAYMENT |
| App activity | CONFIGURABLE_REST_APP | CONFIGURABLE, or another value registered through REST |
| Open slots | CRM_CALENDAR_SHARING | CALENDAR_SHARING |
| Task comment | CRM_TASKS_TASK_COMMENT | TASKS_TASK_COMMENT |
| Task (new version) | CRM_TASKS_TASK | TASKS_TASK |
| Booking activity | CRM_BOOKING | BOOKING |
| Wait list item | CRM_WAIT_LIST_ITEM | WAIT_LIST_ITEM |
| Workflow activity | CRM_BIZPROC_WORKFLOW | BIZPROC_WORKFLOW |
| Workflow assignment comment | CRM_BIZPROC_COMMENT | BIZPROC_COMMENT |
| Workflow assignment | CRM_BIZPROC_TASK | BIZPROC_TASK |
| CRM item exclusion | CRM_ENTITY_EXCLUSION | ENTITY_EXCLUSION |
| Visit | VISIT_TRACKER | VISIT |
| Zoom meeting | ZOOM | ZOOM_CONF_START |
crm_activity_relation — CRM activity associations. This dataset contains data about activity links to CRM items. Use this dataset to see which activities are linked to specific CRM items.
crm_activity_relation
| Field | Description | Data type |
|---|---|---|
| ACTIVITY_ID | Activity ID | Number |
| OWNER_ID | ID of the CRM item the activity is linked to | Number |
| OWNER_TYPE_ID | CRM item type code: 1 — "Lead", 2 — "Deal", 3 — "Contact", 4 — "Company" | Number |
| CREATED_AT | Activity creation date and time | Date and time |
crm_lead_contact — lead-contact links. This dataset contains data about links between leads and contacts.
crm_lead_contact
| Field | Description | Data type |
|---|---|---|
| LEAD_ID | ID of the lead linked to the contact | Number |
| CONTACT_ID | ID of the contact linked to the lead | Number |
| SORT | Sort order of the contact link to the lead | Number |
| IS_PRIMARY |
Shows whether the contact is the primary contact for the lead: Y — yes, N — no
|
String |
crm_deal_contact — deal-contact links. This dataset contains data about links between deals and contacts.
crm_deal_contact
| Field | Description | Data type |
|---|---|---|
| DEAL_ID | Deal ID | Number |
| CONTACT_ID | ID of the contact linked to the deal | Number |
| SORT | Contact order in the deal contact list | Number |
| IS_PRIMARY |
Shows whether the contact is the primary contact for the deal: Y — yes, N — no
|
String |
crm_quote_contact — estimate-contact links. This dataset contains data about links between estimates and contacts.
crm_quote_contact
| Field | Description | Data type |
|---|---|---|
| QUOTE_ID | Estimate ID | Number |
| CONTACT_ID | ID of the contact linked to the estimate | Number |
| SORT | Contact order in the estimate contact list | Number |
| IS_PRIMARY |
Shows whether the contact is the primary contact for the estimate: Y — yes, N — no
|
String |
crm_contact_company — contact-company. This dataset contains data about links between contacts and companies.
crm_contact_company
| Field | Description | Data type |
|---|---|---|
| CONTACT_ID | Contact ID | Number |
| COMPANY_ID | ID of the company linked to the contact | Number |
| SORT | Sort order of the contact-to-company link | Number |
| IS_PRIMARY |
Shows whether the company is the primary company for the contact: Y — yes, N — no
|
String |
crm_entity_contact — SPA item-contact links. This dataset contains data about contact links to SPA items and new invoices.
crm_entity_contact
| Field | Description | Data type |
|---|---|---|
| ENTITY_TYPE_ID | CRM item type ID: 31 — new invoice; for an SPA, the number N from the crm_dynamic_items_N dataset name | Number |
| ENTITY_ID | ID of the SPA item or new invoice | Number |
| CONTACT_ID | ID of the contact linked to the item | Number |
| SORT | Contact order in the item contact list | Number |
| IS_PRIMARY |
Shows whether the contact is the primary contact for the item: Y — yes, N — no
|
String |
crm_stages — CRM stages. This dataset contains data about CRM item stages. Use this dataset to see the current stages of deals or SPAs and their order.
crm_stages
| Field | Description | Data type |
|---|---|---|
| ID | Stage record ID | Number |
| ENTITY_TYPE_ID | CRM item type ID | Number |
| STATUS_ID | Stage code | String |
| NAME | Stage name | String |
| CATEGORY_ID | ID of the pipeline the stage belongs to | Number |
| CATEGORY_NAME | Name of the pipeline the stage belongs to | String |
| SORT | Stage order number | Number |
| SEMANTICS |
Stage type: null — intermediate, S — success, F — failure
|
String |
crm_last_communication — latest communication data for a CRM item. This dataset contains data about the most recent communication with a client for a CRM item. Use it to see when and how an employee contacted the client, such as the date of the last call or email.
crm_last_communication
| Field | Description | Data type |
|---|---|---|
| ENTITY_TYPE_ID | CRM item type ID, such as a deal, lead, or SPA | Number |
| ENTITY_ID | CRM item ID | Number |
| LAST_COMMUNICATION_TIME | Date and time of the latest communication for the CRM item | Date and time |
| TYPE | Latest communication type | String |
| ACTIVITY_ID | ID of the activity where the latest communication was recorded | Number |
Create a chart
Add information from a dataset to charts and track completed activities and deal stages.
- Open BI Builder > Charts.
- Click + Chart in the top-right corner.
- Choose a dataset from the list. If you do not see the dataset you need, click Add a dataset.
Create a dataset - Choose a chart type — the format for viewing the information, such as a card, table, line chart, or another option.
- Click Create new chart.
Merge datasets
Merge datasets to see which activities are linked to your deals in a report.
- Open BI Builder > SQL > SQL Lab.
- Make sure
bitrix24is selected in the Schema field. - Enter the SQL query and click Run.
- Review the query results. To create a chart for a report, save the query as a dataset. The dataset receives data from the fields specified in the SQL query.
Create a chart from a virtual dataset
If this is your first time merging datasets, see the sample query.
Example SQL query
This SQL query extracts data from two datasets: deals (crm_deal) and activities (crm_activity). You can copy it to see how the query works. The query selects a deal with ID 31 and shows the deal, the responsible person, and linked activities. Replace the deal ID before running the query.
SELECT crm_deal.ID AS "Deal ID", crm_deal.TITLE AS "Deal name", crm_deal.ASSIGNED_BY AS "Responsible person", crm_activity.ID AS "Activity ID", crm_activity.SUBJECT AS "Activity subject", crm_activity.DEADLINE AS "Deadline" FROM crm_deal LEFT JOIN crm_activity ON crm_activity.OWNER_ID = crm_deal.ID AND crm_activity.OWNER_TYPE_ID = '2' WHERE crm_deal.ID = 31;
SELECT determines which information to extract from the dataset. For example, SELECT crm_deal.ID AS "Deal ID":
- Selects the deal ID from the
crm_dealdataset - Names it
Deal ID - Shows the result as a separate column in the table
FROM specifies the main dataset the data comes from. Here it is crm_deal, the table with deal information.
LEFT JOIN connects the crm_deal table with crm_activity. The query links the deal to its activities. LEFT JOIN shows all deals, even if they have no linked activities.
WHERE filters the results and shows only a specific deal and its activities. To get data for another deal, replace 31 with the required ID. To see all deals and their activities, remove the WHERE condition.
In brief
- A dataset contains information about leads, deals, companies, and other Bitrix24 items.
- Each item has several datasets that automatically receive data from system and custom fields.
- Datasets for activities, stages, and CRM item links: activities in CRM items (crm_activity), CRM activity associations (crm_activity_relation), lead-contact links (crm_lead_contact), deal-contact links (crm_deal_contact), estimate-contact links (crm_quote_contact), contact-company (crm_contact_company), SPA item-contact links (crm_entity_contact), CRM stages (crm_stages), and latest communication data for a CRM item (crm_last_communication).
- Use datasets to create charts and analyze metrics, such as completed activities and deal stages.
- Merge datasets to see which activities are linked to your deals. Write an SQL query, save the result as a dataset, and create a chart.