Custom Fields for Deals: Overview of Methods

Custom fields store information about a deal 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] => Mandatory
                        )
        

Settings for Custom Fields

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 the cloud Bitrix24, submit a request to technical support to get details about the error.
  • In the 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. You can create 1016 custom fields for deals — this is a limitation of the database architecture. If there are already 1016 fields for deals in Bitrix24, attempting to create a new field will result in the method crm.deal.userfield.add returning an error INTERNAL_SERVER_ERROR.

    You can check the number of custom fields for deals using the method crm.deal.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 is interrupted with an error INTERNAL_SERVER_ERROR.

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

    To check the number of deals in Bitrix24, use the method crm.deal.list.

Overview of Methods

Scope: crm

Who can perform the methods: depending on the method

Method

Description

crm.deal.userfield.add

Creates a new custom field for deals

crm.deal.userfield.update

Modifies an existing custom field for deals

crm.deal.userfield.get

Retrieves a custom field for deals by Id

crm.deal.userfield.list

Gets a list of custom fields for deals

crm.deal.userfield.delete

Deletes a custom field for deals

Event

Triggered

onCrmDealUserFieldAdd

When a custom field is added

onCrmDealUserFieldUpdate

When a custom field is modified

onCrmDealUserFieldDelete

When a custom field is deleted

onCrmDealUserFieldSetEnumValues

When the set of values for a list-type custom field is changed