Custom Company Fields: Overview of Methods

Custom fields store information about a company in various data formats: string, number, link, address, and others.

Quick navigation: all methods

User documentation: Custom fields in CRM

Types of Custom Fields

Use the method crm.userfield.types to retrieve the available types of custom fields. The method will return the ID and name of the field types.

    (
                [ID] => double    
                [title] => Number
            )
        

Use the method crm.userfield.fields to get a list of characteristics of custom fields. The method will return the codes of the characteristics along with their type and name.

    [MANDATORY] => Array
                        (
                            [type] => char
                            [title] => Required
                        )
        

Custom Field Settings

Use the method crm.userfield.settings.fields to obtain a list of available settings. The method will return the supported settings for the requested field type.

    [DEFAULT_VALUE] => Array
                    (
                        [type] => double
                        [title] => Default value
                    )
            [PRECISION] => Array
                    (
                        [type] => int
                        [title] => Precision
                    )
        

Errors When Working with Custom Fields

When creating or deleting custom fields, the request may be interrupted with an error INTERNAL_SERVER_ERROR. This is an internal server error. The cause of the error can be found in the server logs at the time of the request:

  • In cloud Bitrix24, submit a request to technical support to obtain error details.
  • In on-premise Bitrix24, request the server error log from the server administrator or hosting administrator. Then, contact technical support and attach the log for analysis.

Common Causes of Server Errors

  1. Up to 1016 custom fields can be created for companies—this is a limitation of the database architecture. If there are already 1016 fields for companies in Bitrix24, attempting to create a new field will result in an error INTERNAL_SERVER_ERROR when using the method crm.company.userfield.add.

    You can check the number of custom fields for companies using the method crm.company.userfield.list.

  2. There is a limitation on servers for the execution time of a single request—max_execution_time. The standard time is 60 seconds. If the request takes longer, it will be interrupted with an error INTERNAL_SERVER_ERROR.

    The time to create or delete a custom field for a company depends on the number of companies. When a field is created, it is added to all company detail forms. When a field is deleted, it is removed from all detail forms. The fewer companies in your Bitrix24, the faster fields are created and deleted.

    To check the number of companies in Bitrix24, use the method crm.company.list.

Overview of Methods

Scope: crm

Who can execute the methods: depending on the method

Method

Description

crm.company.userfield.add

Creates a new custom field for companies

crm.company.userfield.get

Returns a custom field for companies by ID

crm.company.userfield.list

Returns a list of custom fields for companies by filter

crm.company.userfield.update

Updates an existing custom field for companies

crm.company.userfield.delete

Deletes a custom field for companies