Call the CRM Object Selection Dialog BX24.selectCRM

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
BX24.selectCRM(params: object, callback: callable): void;
        

The BX24.selectCRM method displays the standard dialog for selecting leads, contacts, companies, deals, and estimates.

Bitrix24 renders the dialog over the application frame. The application does not need to retrieve the list of CRM items: users see only the items they can access. The dialog requires no scope of its own because it opens the Bitrix24 interface instead of calling the REST API.

The method can be called only from an application embedded in a Bitrix24 frame. Call it inside the BX24.init handler.

Method Parameters

Required parameters are marked with *

Name
type

Description

entityType
array

Object types to display in the dialog. Possible values:

  • lead — leads
  • contact — contacts
  • company — companies
  • deal — deals
  • quote — estimates

The method excludes unsupported values. If the parameter is omitted or the list is empty after unsupported values are excluded, the method displays leads, contacts, and companies

multiple
boolean

Allows selecting multiple objects. Default is false

value
object

Objects to mark as selected when the dialog opens (detailed description).

The method ignores identifiers less than one. If multiple is false and value contains multiple items, the first item remains selected

callback*
callable

Callback function that receives the selected CRM objects (detailed description)

value Parameter

The key of the value object is a CRM object type, and the value is an array of numeric identifiers. Pass only the types specified in entityType.

Name
type

Description

lead
integer[]

Lead identifiers

contact
integer[]

Contact identifiers

company
integer[]

Company identifiers

deal
integer[]

Deal identifiers

quote
integer[]

Estimate identifiers

Code Example

Display a multiple-selection dialog, preselect several items, and output the selected objects:

BX24.init(() => {
            BX24.selectCRM(
                {
                    entityType: ['lead', 'contact', 'company', 'deal', 'quote'],
                    multiple: true,
                    value: {
                        lead: [1348, 2, 35],
                        contact: [2],
                        company: [4, 3],
                        deal: [1, 2],
                        quote: [1]
                    }
                },
                (selected) => {
                    console.log(selected);
                }
            );
        });
        

How to Use Examples in Documentation

Response Handling

The dialog does not return data directly. After the selection is confirmed, callback receives an object whose items are grouped by CRM type: lead, contact, company, deal, and quote.

If the user closes the dialog using the close or cancel button, callback is not called.

{
            "lead": {
                "0": {
                    "id": "L_1348",
                    "type": "lead",
                    "place": "lead",
                    "title": "Guest #2 - Bitrix Open Channel",
                    "desc": "Guest",
                    "url": "/crm/lead/show/1348/"
                }
            },
            "contact": {
                "0": {
                    "id": "C_2",
                    "type": "contact",
                    "place": "contact",
                    "title": "Klaus Weber",
                    "desc": "",
                    "url": "/crm/contact/show/2/",
                    "image": "/upload/resize_cache/crm/8b5/25_25_2/MM35_PG13.jpg"
                }
            },
            "company": {},
            "deal": {},
            "quote": {}
        }
        

Returned Data

Each object key contains selected items of the corresponding type. Items are stored under numeric keys 0, 1, and so on.

Name
type

Description

lead
object

Selected leads

contact
object

Selected contacts

company
object

Selected companies

deal
object

Selected deals

quote
object

Selected estimates

Selected Item Fields

Name
type

Description

id
string

Item identifier with a type prefix: L_ for a lead, C_ for a contact, CO_ for a company, D_ for a deal, and Q_ for an estimate

type
string

CRM item type: lead, contact, company, deal, or quote

place
string

Item type in the dialog interface

title
string

Item name

desc
string

Additional item description. Its contents depend on the object type

url
string

Relative path to the CRM item form

image
string

Relative path to the item image. The field may be absent

largeImage
string

Relative path to the large item image. The field may be absent

customData
any

Additional item data. Returned if the selection component supplied the data

advancedInfo
any

Extended item information. Returned if the selection component supplied the data

Error Handling

The dialog returns no error codes. The method ignores unsupported entityType values and invalid identifiers in value. If the user closes the dialog without confirming the selection, callback is not called.

Continue Exploring