Create a Custom Field for Estimates crm.quote.userfield.add
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
Scope:
crmWho can execute the method: a user with the "Edit CRM preferences" permission in CRM
DEPRECATED
The development of this method has been halted. Please use the REST 3.0 method crm.quote.field.custom.add. The REST 3.0 method does not create fields of the List enumeration and File file types, so use this method for them.
The method crm.quote.userfield.add creates a custom field in all estimates in Bitrix24 and returns its ID. The type USER_TYPE_ID, the code FIELD_NAME, and the multiple flag MULTIPLE cannot be changed after the field is created.
In REST 3.0, the field is created by the crm.quote.field.custom.add method.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
fields* |
Object format:
The list of available fields is described below. An incorrect field in |
Parameter fields
Required parameters are marked with *
|
Name |
Description |
|
USER_TYPE_ID* |
Data type of the custom field. The method crm.userfield.types returns the list of types available in Bitrix24. Possible values:
|
|
FIELD_NAME* |
Field code, unique among estimate fields. Bitrix24 builds the full name from the code with the prefix
The field value is written and read by the universal methods crm.item.update and crm.item.get with The full name is up to The code allows |
|
LABEL |
Field name. If If |
|
XML_ID |
External code |
|
Filter label in the list. What the method writes:
|
|
|
Header in the list. What the method writes:
|
|
|
Label in the edit form. What the method writes:
|
|
|
Error message. A string and a |
|
|
Help. A string and a |
|
|
MULTIPLE |
Whether the field is multiple, that is, whether it can store several values. Possible values:
Fields of type By default, |
|
MANDATORY |
Is the field mandatory. Possible values:
By default, |
|
SHOW_FILTER |
Show the field in the filter. Possible values:
By default, Instead of
|
|
SETTINGS |
Additional field parameters. The set of settings depends on the field type |
|
LIST |
List of possible values for the custom field of type By default |
|
SORT |
Sort index. Must be greater than zero. By default |
|
SHOW_IN_LIST |
Show the field in the list. The parameter is not used in CRM. Possible values:
By default |
|
EDIT_IN_LIST |
Allow user editing. Possible values:
By default |
|
IS_SEARCHABLE |
Are the field values included in the search. The parameter is not used in CRM. Possible values:
By default |
Parameter SETTINGS
The set of settings depends on the field type. The method saves only the settings from the tabs below and skips other SETTINGS keys. For the money, url, address, file, employee types and custom types, the method ignores SETTINGS entirely, and the field gets the default type settings.
The method crm.quote.userfield.get returns the saved field settings, and the method crm.userfield.settings.fields returns the list of type settings. Only the settings from the tabs below can be passed in SETTINGS.
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Default |
|
ROWS |
Number of lines in the input field. Must be greater than zero. Default |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value |
|
PRECISION |
Number precision. Must be greater than or equal to 0. Default |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value: Default |
|
DISPLAY |
Appearance. Possible values:
Default |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value.
where:
Default value:
|
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
Default |
|
LIST_HEIGHT |
List height. Must be greater than zero. Available only when Default |
|
Name |
Description |
|
IBLOCK_TYPE_ID |
Information block type identifier. Default |
|
IBLOCK_ID |
Information block identifier. Default |
|
DEFAULT_VALUE |
Default value. Default |
|
DISPLAY |
Appearance. Possible values:
Default |
|
LIST_HEIGHT |
List height. Must be greater than zero. Default |
|
ACTIVE_FILTER |
Whether to show elements with the activity flag enabled. Possible values:
Default |
|
Name |
Description |
|
ENTITY_TYPE |
Directory type identifier. Use Default |
If all bindings are disabled, Bitrix24 enables binding to leads LEAD = Y.
|
Name |
Description |
|
LEAD |
Whether binding to leads is enabled. Possible values:
Default |
|
CONTACT |
Whether binding to contacts is enabled. Possible values:
Default |
|
COMPANY |
Whether binding to companies is enabled. Possible values:
Default |
|
DEAL |
Whether binding to deals is enabled. Possible values:
Default |
Parameter LIST
Warning
If the LIST items are not saved, for example, because of a duplicate XML_ID, the method returns an error, but the field is already created — without list items. Before calling the method again, find the field with the method crm.quote.userfield.list and add the items with the method crm.quote.userfield.update or delete the field.
|
Name |
Description |
|
VALUE |
Value of the list item. List items with an empty or missing |
|
SORT |
Sort index. A value of By default |
|
DEF |
Is the list item the default value. Possible values:
A multiple field can have several default values. For a field with By default |
|
XML_ID |
External code of the value. Must be unique within the list items of the custom field |
Code Examples
How to Use Examples in Documentation
Example of Creating a Custom Field of Type String
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Hello, World! Field","USER_TYPE_ID":"string","FIELD_NAME":"HELLO_WORLD","MULTIPLE":"Y","MANDATORY":"Y","SHOW_FILTER":"Y","SETTINGS":{"DEFAULT_VALUE":"Hello, World! Default Value","ROWS":3},"SORT":1000,"EDIT_IN_LIST":"Y","LIST_FILTER_LABEL":"Hello, World! Filter","LIST_COLUMN_LABEL":{"en":"Hello, World! Column","de":"Hallo, Welt! Spalte"},"EDIT_FORM_LABEL":{"en":"Hello, World! Edit","de":"Hallo, Welt! Bearbeiten"},"ERROR_MESSAGE":{"en":"Hello, World! Error","de":"Hallo, Welt! Fehler"},"HELP_MESSAGE":{"en":"Hello, World! Help","de":"Hallo, Welt! Hilfe"}}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.quote.userfield.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Hello, World! Field","USER_TYPE_ID":"string","FIELD_NAME":"HELLO_WORLD","MULTIPLE":"Y","MANDATORY":"Y","SHOW_FILTER":"Y","SETTINGS":{"DEFAULT_VALUE":"Hello, World! Default Value","ROWS":3},"SORT":1000,"EDIT_IN_LIST":"Y","LIST_FILTER_LABEL":"Hello, World! Filter","LIST_COLUMN_LABEL":{"en":"Hello, World! Column","de":"Hallo, Welt! Spalte"},"EDIT_FORM_LABEL":{"en":"Hello, World! Edit","de":"Hallo, Welt! Bearbeiten"},"ERROR_MESSAGE":{"en":"Hello, World! Error","de":"Hallo, Welt! Fehler"},"HELP_MESSAGE":{"en":"Hello, World! Help","de":"Hallo, Welt! Hilfe"}},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.quote.userfield.add
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
try {
const response = await $b24.actions.v2.call.make<number>({
method: 'crm.quote.userfield.add',
params: {
fields: {
LABEL: 'Hello, World! Field',
USER_TYPE_ID: 'string',
FIELD_NAME: 'HELLO_WORLD',
MULTIPLE: 'Y',
MANDATORY: 'Y',
SHOW_FILTER: 'Y',
SETTINGS: {
DEFAULT_VALUE: 'Hello, World! Default value',
ROWS: 3,
},
SORT: 1000,
EDIT_IN_LIST: 'Y',
LIST_FILTER_LABEL: 'Hello, World! Filter',
LIST_COLUMN_LABEL: {
en: 'Hello, World! Column',
de: 'Hallo, Welt! Spalte',
},
EDIT_FORM_LABEL: {
en: 'Hello, World! Edit',
de: 'Hallo, Welt! Bearbeiten',
},
ERROR_MESSAGE: {
en: 'Hello, World! Error',
de: 'Hallo, Welt! Fehler',
},
HELP_MESSAGE: {
en: 'Hello, World! Help',
de: 'Hallo, Welt! Hilfe',
},
},
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info('Created userfield ID:', result)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function addStringQuoteUserfield() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.quote.userfield.add',
params: {
fields: {
LABEL: 'Hello, World! Field',
USER_TYPE_ID: 'string',
FIELD_NAME: 'HELLO_WORLD',
MULTIPLE: 'Y',
MANDATORY: 'Y',
SHOW_FILTER: 'Y',
SETTINGS: {
DEFAULT_VALUE: 'Hello, World! Default value',
ROWS: 3,
},
SORT: 1000,
EDIT_IN_LIST: 'Y',
LIST_FILTER_LABEL: 'Hello, World! Filter',
LIST_COLUMN_LABEL: {
en: 'Hello, World! Column',
de: 'Hallo, Welt! Spalte',
},
EDIT_FORM_LABEL: {
en: 'Hello, World! Edit',
de: 'Hallo, Welt! Bearbeiten',
},
ERROR_MESSAGE: {
en: 'Hello, World! Error',
de: 'Hallo, Welt! Fehler',
},
HELP_MESSAGE: {
en: 'Hello, World! Help',
de: 'Hallo, Welt! Hilfe',
},
},
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info('Created userfield ID:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', addStringQuoteUserfield)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.crm.quote.userfield.add(
fields={
"LABEL": "Hello, world! Field",
"USER_TYPE_ID": "string",
"FIELD_NAME": "HELLO_WORLD",
"MULTIPLE": "Y",
"MANDATORY": "Y",
"SHOW_FILTER": "Y",
"SETTINGS": {
"DEFAULT_VALUE": "Hello, world! Default value",
"ROWS": 3,
},
"SORT": 1000,
"EDIT_IN_LIST": "Y",
"LIST_FILTER_LABEL": "Hello, world! Filter",
"LIST_COLUMN_LABEL": {
"en": "Hello, World! Column",
"de": "Hallo, Welt! Spalte",
},
"EDIT_FORM_LABEL": {
"en": "Hello, World! Edit",
"de": "Hallo, Welt! Bearbeiten",
},
"ERROR_MESSAGE": {
"en": "Hello, World! Error",
"de": "Hallo, Welt! Fehler",
},
"HELP_MESSAGE": {
"en": "Hello, World! Help",
"de": "Hallo, Welt! Hilfe",
},
},
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Bitrix API Error",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Bitrix SDK Error: {error.message}")
except Exception as error:
print(f"Unexpected error: {error}")
try {
$userfieldItemFields = [
'FIELD_NAME' => 'HELLO_WORLD',
'USER_TYPE_ID' => 'string',
'SORT' => 1000,
'MULTIPLE' => 'Y',
'MANDATORY' => 'Y',
'SHOW_FILTER' => 'Y',
'EDIT_IN_LIST' => 'Y',
'LIST_FILTER_LABEL' => 'Hello, world! Filter',
'LABEL' => 'Hello, world! Field',
'LIST_COLUMN_LABEL' => [
'en' => 'Hello, World! Column',
'de' => 'Hallo, Welt! Spalte',
],
'EDIT_FORM_LABEL' => [
'en' => 'Hello, World! Edit',
'de' => 'Hallo, Welt! Bearbeiten',
],
'ERROR_MESSAGE' => [
'en' => 'Hello, World! Error',
'de' => 'Hallo, Welt! Fehler',
],
'HELP_MESSAGE' => [
'en' => 'Hello, World! Help',
'de' => 'Hallo, Welt! Hilfe',
],
'SETTINGS' => [
'DEFAULT_VALUE' => 'Hello, world! Default value',
'ROWS' => 3,
],
];
$result = $serviceBuilder
->getCRMScope()
->quoteUserfield()
->add($userfieldItemFields);
print($result->getId());
} catch (Throwable $e) {
print('Error: ' . $e->getMessage());
}
BX24.callMethod(
'crm.quote.userfield.add',
{
fields: {
LABEL: 'Hello, world! Field',
USER_TYPE_ID: 'string',
FIELD_NAME: 'HELLO_WORLD',
MULTIPLE: 'Y',
MANDATORY: 'Y',
SHOW_FILTER: 'Y',
SETTINGS: {
DEFAULT_VALUE: 'Hello, world! Default value',
ROWS: 3,
},
SORT: 1000,
EDIT_IN_LIST: 'Y',
LIST_FILTER_LABEL: 'Hello, world! Filter',
LIST_COLUMN_LABEL: {
en: 'Hello, World! Column',
de: 'Hallo, Welt! Spalte',
},
EDIT_FORM_LABEL: {
en: 'Hello, World! Edit',
de: 'Hallo, Welt! Bearbeiten',
},
ERROR_MESSAGE: {
en: 'Hello, World! Error',
de: 'Hallo, Welt! Fehler',
},
HELP_MESSAGE: {
en: 'Hello, World! Help',
de: 'Hallo, Welt! Hilfe',
},
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.quote.userfield.add',
[
'fields' => [
'LABEL' => 'Hello, world! Field',
'USER_TYPE_ID' => 'string',
'FIELD_NAME' => 'HELLO_WORLD',
'MULTIPLE' => 'Y',
'MANDATORY' => 'Y',
'SHOW_FILTER' => 'Y',
'SETTINGS' => [
'DEFAULT_VALUE' => 'Hello, world! Default value',
'ROWS' => 3,
],
'SORT' => 1000,
'EDIT_IN_LIST' => 'Y',
'LIST_FILTER_LABEL' => 'Hello, world! Filter',
'LIST_COLUMN_LABEL' => [
'en' => 'Hello, World! Column',
'de' => 'Hallo, Welt! Spalte',
],
'EDIT_FORM_LABEL' => [
'en' => 'Hello, World! Edit',
'de' => 'Hallo, Welt! Bearbeiten',
],
'ERROR_MESSAGE' => [
'en' => 'Hello, World! Error',
'de' => 'Hallo, Welt! Fehler',
],
'HELP_MESSAGE' => [
'en' => 'Hello, World! Help',
'de' => 'Hallo, Welt! Hilfe',
],
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client and ctx are already created — see the Go SDK section
res, err := client.Core().Call(ctx, "crm.quote.userfield.add", b24.Params{
"fields": b24.Params{
"LABEL": "Hello, World! Field",
"USER_TYPE_ID": "string",
"FIELD_NAME": "HELLO_WORLD",
"MULTIPLE": "Y",
"MANDATORY": "Y",
"SHOW_FILTER": "Y",
"SETTINGS": b24.Params{
"DEFAULT_VALUE": "Hello, World! Default Value",
"ROWS": 3,
},
"SORT": 1000,
"EDIT_IN_LIST": "Y",
"LIST_FILTER_LABEL": "Hello, World! Filter",
"LIST_COLUMN_LABEL": b24.Params{
"en": "Hello, World! Column",
"de": "Hallo, Welt! Spalte",
},
"EDIT_FORM_LABEL": b24.Params{
"en": "Hello, World! Edit",
"de": "Hallo, Welt! Bearbeiten",
},
"ERROR_MESSAGE": b24.Params{
"en": "Hello, World! Error",
"de": "Hallo, Welt! Fehler",
},
"HELP_MESSAGE": b24.Params{
"en": "Hello, World! Help",
"de": "Hallo, Welt! Hilfe",
},
},
})
if err != nil {
return fmt.Errorf("crm.quote.userfield.add: %w", err)
}
var newID b24.ID
if err := json.Unmarshal(res.Result, &newID); err != nil {
return fmt.Errorf("parse response: %w", err)
}
fmt.Println("id:", newID)
Example of Creating a Custom Field of Type List
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Custom field (list)","USER_TYPE_ID":"enumeration","FIELD_NAME":"ENUM_EXAMPLE","MULTIPLE":"N","MANDATORY":"N","SHOW_FILTER":"Y","LIST":[{"VALUE":"List item #1","DEF":"Y","XML_ID":"XML_ID_1","SORT":100},{"VALUE":"List item #2","XML_ID":"XML_ID_2","SORT":200},{"VALUE":"List item #3","XML_ID":"XML_ID_3","SORT":300},{"VALUE":"List item #4","XML_ID":"XML_ID_4","SORT":400}],"SETTINGS":{"DISPLAY":"UI","LIST_HEIGHT":2},"SORT":2000}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.quote.userfield.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Custom field (list)","USER_TYPE_ID":"enumeration","FIELD_NAME":"ENUM_EXAMPLE","MULTIPLE":"N","MANDATORY":"N","SHOW_FILTER":"Y","LIST":[{"VALUE":"List item #1","DEF":"Y","XML_ID":"XML_ID_1","SORT":100},{"VALUE":"List item #2","XML_ID":"XML_ID_2","SORT":200},{"VALUE":"List item #3","XML_ID":"XML_ID_3","SORT":300},{"VALUE":"List item #4","XML_ID":"XML_ID_4","SORT":400}],"SETTINGS":{"DISPLAY":"UI","LIST_HEIGHT":2},"SORT":2000},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.quote.userfield.add
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
try {
const response = await $b24.actions.v2.call.make<number>({
method: 'crm.quote.userfield.add',
params: {
fields: {
LABEL: 'Custom field (list)',
USER_TYPE_ID: 'enumeration',
FIELD_NAME: 'ENUM_EXAMPLE',
MULTIPLE: 'N',
MANDATORY: 'N',
SHOW_FILTER: 'Y',
LIST: [
{
VALUE: 'List item #1',
DEF: 'Y',
XML_ID: 'XML_ID_1',
SORT: 100,
},
{
VALUE: 'List item #2',
XML_ID: 'XML_ID_2',
SORT: 200,
},
{
VALUE: 'List item #3',
XML_ID: 'XML_ID_3',
SORT: 300,
},
{
VALUE: 'List item #4',
XML_ID: 'XML_ID_4',
SORT: 400,
},
],
SETTINGS: {
DISPLAY: 'UI',
LIST_HEIGHT: 2,
},
SORT: 2000,
},
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info('Created userfield ID:', result)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function addEnumerationQuoteUserfield() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.quote.userfield.add',
params: {
fields: {
LABEL: 'Custom field (list)',
USER_TYPE_ID: 'enumeration',
FIELD_NAME: 'ENUM_EXAMPLE',
MULTIPLE: 'N',
MANDATORY: 'N',
SHOW_FILTER: 'Y',
LIST: [
{
VALUE: 'List item #1',
DEF: 'Y',
XML_ID: 'XML_ID_1',
SORT: 100,
},
{
VALUE: 'List item #2',
XML_ID: 'XML_ID_2',
SORT: 200,
},
{
VALUE: 'List item #3',
XML_ID: 'XML_ID_3',
SORT: 300,
},
{
VALUE: 'List item #4',
XML_ID: 'XML_ID_4',
SORT: 400,
},
],
SETTINGS: {
DISPLAY: 'UI',
LIST_HEIGHT: 2,
},
SORT: 2000,
},
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info('Created userfield ID:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', addEnumerationQuoteUserfield)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.crm.quote.userfield.add(
fields={
"LABEL": "Custom field (list)",
"USER_TYPE_ID": "enumeration",
"FIELD_NAME": "ENUM_EXAMPLE",
"MULTIPLE": "N",
"MANDATORY": "N",
"SHOW_FILTER": "Y",
"LIST": [
{
"VALUE": "List item #1",
"DEF": "Y",
"XML_ID": "XML_ID_1",
"SORT": 100,
},
{
"VALUE": "List item #2",
"XML_ID": "XML_ID_2",
"SORT": 200,
},
{
"VALUE": "List item #3",
"XML_ID": "XML_ID_3",
"SORT": 300,
},
{
"VALUE": "List item #4",
"XML_ID": "XML_ID_4",
"SORT": 400,
},
],
"SETTINGS": {
"DISPLAY": "UI",
"LIST_HEIGHT": 2,
},
"SORT": 2000,
},
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Bitrix API Error",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Bitrix SDK Error: {error.message}")
except Exception as error:
print(f"Unexpected error: {error}")
try {
$userfieldItemFields = [
'LABEL' => 'Custom field (list)',
'USER_TYPE_ID' => 'enumeration',
// The PHP SDK accepts a field code of up to 13 characters
'FIELD_NAME' => 'ENUM_EXAMPLE',
'MULTIPLE' => 'N',
'MANDATORY' => 'N',
'SHOW_FILTER' => 'Y',
'LIST' => [
['VALUE' => 'List item #1', 'DEF' => 'Y', 'XML_ID' => 'XML_ID_1', 'SORT' => 100],
['VALUE' => 'List item #2', 'XML_ID' => 'XML_ID_2', 'SORT' => 200],
['VALUE' => 'List item #3', 'XML_ID' => 'XML_ID_3', 'SORT' => 300],
['VALUE' => 'List item #4', 'XML_ID' => 'XML_ID_4', 'SORT' => 400],
],
'SETTINGS' => ['DISPLAY' => 'UI', 'LIST_HEIGHT' => 2],
'SORT' => 2000,
];
$result = $serviceBuilder
->getCRMScope()
->quoteUserfield()
->add($userfieldItemFields);
print($result->getId());
} catch (Throwable $e) {
print('Error: ' . $e->getMessage());
}
BX24.callMethod(
'crm.quote.userfield.add',
{
fields: {
LABEL: 'Custom field (list)',
USER_TYPE_ID: 'enumeration',
FIELD_NAME: 'ENUM_EXAMPLE',
MULTIPLE: 'N',
MANDATORY: 'N',
SHOW_FILTER: 'Y',
LIST: [
{ VALUE: 'List item #1', DEF: 'Y', XML_ID: 'XML_ID_1', SORT: 100 },
{ VALUE: 'List item #2', XML_ID: 'XML_ID_2', SORT: 200 },
{ VALUE: 'List item #3', XML_ID: 'XML_ID_3', SORT: 300 },
{ VALUE: 'List item #4', XML_ID: 'XML_ID_4', SORT: 400 },
],
SETTINGS: { DISPLAY: 'UI', LIST_HEIGHT: 2 },
SORT: 2000,
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.quote.userfield.add',
[
'fields' => [
'LABEL' => 'Custom field (list)',
'USER_TYPE_ID' => 'enumeration',
'FIELD_NAME' => 'ENUM_EXAMPLE',
'MULTIPLE' => 'N',
'MANDATORY' => 'N',
'SHOW_FILTER' => 'Y',
'LIST' => [
['VALUE' => 'List item #1', 'DEF' => 'Y', 'XML_ID' => 'XML_ID_1', 'SORT' => 100],
['VALUE' => 'List item #2', 'XML_ID' => 'XML_ID_2', 'SORT' => 200],
['VALUE' => 'List item #3', 'XML_ID' => 'XML_ID_3', 'SORT' => 300],
['VALUE' => 'List item #4', 'XML_ID' => 'XML_ID_4', 'SORT' => 400],
],
'SETTINGS' => [
'DISPLAY' => 'UI',
'LIST_HEIGHT' => 2,
],
'SORT' => 2000,
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client and ctx are already created — see the Go SDK section
res, err := client.Core().Call(ctx, "crm.quote.userfield.add", b24.Params{
"fields": b24.Params{
"LABEL": "Custom field (list)",
"USER_TYPE_ID": "enumeration",
"FIELD_NAME": "ENUM_EXAMPLE",
"MULTIPLE": "N",
"MANDATORY": "N",
"SHOW_FILTER": "Y",
"LIST": []b24.Params{
{
"VALUE": "List item #1",
"DEF": "Y",
"XML_ID": "XML_ID_1",
"SORT": 100,
},
{
"VALUE": "List item #2",
"XML_ID": "XML_ID_2",
"SORT": 200,
},
{
"VALUE": "List item #3",
"XML_ID": "XML_ID_3",
"SORT": 300,
},
{
"VALUE": "List item #4",
"XML_ID": "XML_ID_4",
"SORT": 400,
},
},
"SETTINGS": b24.Params{
"DISPLAY": "UI",
"LIST_HEIGHT": 2,
},
"SORT": 2000,
},
})
if err != nil {
return fmt.Errorf("crm.quote.userfield.add: %w", err)
}
var newID b24.ID
if err := json.Unmarshal(res.Result, &newID); err != nil {
return fmt.Errorf("parse response: %w", err)
}
fmt.Println("id:", newID)
Response Handling
HTTP status: 200
{
"result": 6997,
"time": {
"start": 1753789240.8146,
"finish": 1753789241.058695,
"duration": 0.2440950870513916,
"processing": 0.19217395782470703,
"date_start": "2025-07-29T14:40:40+03:00",
"date_finish": "2025-07-29T14:40:41+03:00",
"operating_reset_at": 1753789840,
"operating": 0.19216084480285645
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response, contains the identifier of the created custom field |
|
time |
Information about the request execution time |
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "The 'USER_TYPE_ID' field is not found."
}
|
Name |
Description |
|
error |
String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only |
|
error_description |
Error message for the developer. Do not show it to the end user without processing |
Possible Error Codes
If both USER_TYPE_ID and FIELD_NAME are not provided, both errors are returned in one error_description, separated by a line break.
|
Status |
Code |
Description |
Value |
|
|
Empty value |
|
The user does not have the "Edit CRM preferences" permission in CRM |
|
|
Empty value |
|
|
|
|
|
|
The full field name including the prefix |
|
|
|
|
The provided |
|
|
Empty value |
|
|
|
|
|
|
The provided |
|
|
|
|
An estimate field with this |
|
|
|
|
|
|
|
|
Depends on the cause |
Estimates already have 1016 custom fields, or the field creation did not complete within |
Statuses and System Error Codes
HTTP Status: 4xx, 5xx
The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — |
|
|
|
No active webhook with the specified user identifier and secret code was found |
|
|
|
No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope |
|
|
|
The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Update Existing Custom Field for Quotes crm.quote.userfield.update
- Get Custom Field of Estimates by ID crm.quote.userfield.get
- Get a List of Custom Fields For crm.quote.userfield.list
- Delete Custom Field for Quotes crm.quote.userfield.delete
- Update Item crm.item.update
- Custom Fields for Estimates: Overview of Methods and Events