Get Custom Contact Field by Id crm.contact.userfield.get
Scope:
crmWho can execute the method: administrator
The method crm.contact.userfield.get returns a custom contact field by its identifier.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Identifier of the custom field associated with the contact. The identifier can be obtained using the methods |
Code Examples
How to Use Examples in Documentation
Get the custom field with id = 399
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":399}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.contact.userfield.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":399,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.contact.userfield.get
try
{
const response = await $b24.callMethod(
'crm.contact.userfield.get',
{
id: 399,
}
);
const result = response.getData().result;
result.error()
? console.error(result.error())
: console.info(result)
;
}
catch( error )
{
console.error('Error:', error);
}
try {
$response = $b24Service
->core
->call(
'crm.contact.userfield.get',
[
'id' => 399,
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
echo 'Error: ' . $result->error();
} else {
echo 'Data: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting contact user field: ' . $e->getMessage();
}
BX24.callMethod(
'crm.contact.userfield.get',
{
id: 399,
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$result = CRest::call(
'crm.contact.userfield.get',
[
'id' => 399
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP Status: 200
{
"result": {
"ID": "399",
"ENTITY_ID": "CRM_CONTACT",
"FIELD_NAME": "UF_CRM_HELLO_WORLD",
"USER_TYPE_ID": "string",
"XML_ID": null,
"SORT": "1000",
"MULTIPLE": "Y",
"MANDATORY": "Y",
"SHOW_FILTER": "E",
"SHOW_IN_LIST": "Y",
"EDIT_IN_LIST": "Y",
"IS_SEARCHABLE": "Y",
"SETTINGS": {
"SIZE": 20,
"ROWS": 3,
"REGEXP": "",
"MIN_LENGTH": 0,
"MAX_LENGTH": 0,
"DEFAULT_VALUE": "Hello, World! Default value"
},
"EDIT_FORM_LABEL": {
"ar": "Field \u0027Hello, World!\u0027",
"br": "Field \u0027Hello, World!\u0027",
"en": "Hello, World! Edit",
"fr": "Field \u0027Hello, World!\u0027",
"id": "Field \u0027Hello, World!\u0027",
"it": "Field \u0027Hello, World!\u0027",
"ja": "Field \u0027Hello, World!\u0027",
"la": "Field \u0027Hello, World!\u0027",
"ms": "Field \u0027Hello, World!\u0027",
"pl": "Field \u0027Hello, World!\u0027",
"ru": "Hello, World! Edit",
"sc": "Field \u0027Hello, World!\u0027",
"tc": "Field \u0027Hello, World!\u0027",
"th": "Field \u0027Hello, World!\u0027",
"tr": "Field \u0027Hello, World!\u0027",
"vn": "Field \u0027Hello, World!\u0027"
},
"LIST_COLUMN_LABEL": {
"ar": "Field \u0027Hello, World!\u0027",
"br": "Field \u0027Hello, World!\u0027",
"en": "Hello, World! Column",
"fr": "Field \u0027Hello, World!\u0027",
"id": "Field \u0027Hello, World!\u0027",
"it": "Field \u0027Hello, World!\u0027",
"ja": "Field \u0027Hello, World!\u0027",
"la": "Field \u0027Hello, World!\u0027",
"ms": "Field \u0027Hello, World!\u0027",
"pl": "Field \u0027Hello, World!\u0027",
"ru": "Hello, World! Column",
"sc": "Field \u0027Hello, World!\u0027",
"tc": "Field \u0027Hello, World!\u0027",
"th": "Field \u0027Hello, World!\u0027",
"tr": "Field \u0027Hello, World!\u0027",
"vn": "Field \u0027Hello, World!\u0027"
},
"LIST_FILTER_LABEL": {
"ar": "Hello, World! Filter",
"br": "Hello, World! Filter",
"en": "Hello, World! Filter",
"fr": "Hello, World! Filter",
"id": "Hello, World! Filter",
"it": "Hello, World! Filter",
"ja": "Hello, World! Filter",
"la": "Hello, World! Filter",
"ms": "Hello, World! Filter",
"pl": "Hello, World! Filter",
"ru": "Hello, World! Filter",
"sc": "Hello, World! Filter",
"tc": "Hello, World! Filter",
"th": "Hello, World! Filter",
"tr": "Hello, World! Filter",
"vn": "Hello, World! Filter"
},
"ERROR_MESSAGE": {
"ar": "Field \u0027Hello, World!\u0027",
"br": "Field \u0027Hello, World!\u0027",
"en": "Hello, World! Error",
"fr": "Field \u0027Hello, World!\u0027",
"id": "Field \u0027Hello, World!\u0027",
"it": "Field \u0027Hello, World!\u0027",
"ja": "Field \u0027Hello, World!\u0027",
"la": "Field \u0027Hello, World!\u0027",
"ms": "Field \u0027Hello, World!\u0027",
"pl": "Field \u0027Hello, World!\u0027",
"ru": "Hello, World! Error",
"sc": "Field \u0027Hello, World!\u0027",
"tc": "Field \u0027Hello, World!\u0027",
"th": "Field \u0027Hello, World!\u0027",
"tr": "Field \u0027Hello, World!\u0027",
"vn": "Field \u0027Hello, World!\u0027"
},
"HELP_MESSAGE": {
"ar": "Field \u0027Hello, World!\u0027",
"br": "Field \u0027Hello, World!\u0027",
"en": "Hello, World! Help",
"fr": "Field \u0027Hello, World!\u0027",
"id": "Field \u0027Hello, World!\u0027",
"it": "Field \u0027Hello, World!\u0027",
"ja": "Field \u0027Hello, World!\u0027",
"la": "Field \u0027Hello, World!\u0027",
"ms": "Field \u0027Hello, World!\u0027",
"pl": "Field \u0027Hello, World!\u0027",
"ru": "Hello, World! Help",
"sc": "Field \u0027Hello, World!\u0027",
"tc": "Field \u0027Hello, World!\u0027",
"th": "Field \u0027Hello, World!\u0027",
"tr": "Field \u0027Hello, World!\u0027",
"vn": "Field \u0027Hello, World!\u0027"
}
},
"time": {
"start": 1724318753.341079,
"finish": 1724318753.621247,
"duration": 0.2801680564880371,
"processing": 0.023567914962768555,
"date_start": "2024-08-22T11:25:53+02:00",
"date_finish": "2024-08-22T11:25:53+02:00",
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response, contains information about the custom field |
|
time |
Information about the request execution time |
userfield
|
Parameter |
Description |
|
ID |
Identifier of the custom field |
|
ENTITY_ID |
String identifier binding the custom field to the entity. In the case of methods |
|
FIELD_NAME |
Field code. Unique |
|
USER_TYPE_ID |
Data type of the custom field. Possible values:
|
|
XML_ID |
External code |
|
SORT |
Sort index |
|
MULTIPLE |
Indicates whether the field is multiple. Possible values:
|
|
MANDATORY |
Indicates whether the field is mandatory. Possible values:
|
|
SHOW_FILTER |
Indicates whether to show the field in the filter. Possible values:
|
|
SHOW_IN_LIST |
Indicates whether to show the custom field in the list. This parameter does not affect anything within Possible values:
|
|
EDIT_IN_LIST |
Allows user editing. Possible values:
|
|
IS_SEARCHABLE |
Indicates whether the field values participate in search. This parameter does not affect anything within Possible values:
|
|
SETTINGS |
Additional field parameters. Each field type ( |
|
LIST |
List of possible values for the custom field of type |
|
EDIT_FORM_LABEL |
Label in the edit form |
|
LIST_COLUMN_LABEL |
Header in the list |
|
LIST_FILTER_LABEL |
Filter label in the list |
|
ERROR_MESSAGE |
Error message |
|
HELP_MESSAGE |
Help |
|
USER_TYPE_OWNER |
Returned when the field type is custom |
Parameter settings
|
Name |
Description |
|
PRECISION |
Precision (number of decimal places) |
|
SIZE |
Input field size for display |
|
MIN_VALUE |
Minimum value (0 — do not check) |
|
MAX_VALUE |
Maximum value (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Indicates whether it is the default value. Possible values:
|
|
DISPLAY |
Appearance. Possible values:
|
|
LABEL |
Labels for values, where:
|
|
LABEL_CHECKBOX |
Checkbox label |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Object format:
where:
|
|
Name |
Description |
|
SIZE |
Input field size for display |
|
MIN_VALUE |
Minimum value (0 — do not check) |
|
MAX_VALUE |
Maximum value (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Object format:
where:
|
|
USE_SECOND |
Whether to use seconds. Possible values:
|
|
USE_TIMEZONE |
Whether to use time zones. Possible values:
|
|
Name |
Description |
|
SIZE |
Input field size for display |
|
ROWS |
Number of lines in the input field |
|
REGEXP |
Regular expression for validation |
|
MIN_LENGTH |
Minimum string length (0 — do not check) |
|
MAX_LENGTH |
Maximum string length (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
|
|
LIST_HEIGHT |
List height |
|
CAPTION_NO_VALUE |
Label when no value is present |
|
SHOW_NO_VALUE |
Whether to show empty value for mandatory field. Possible values:
|
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
|
|
LIST_HEIGHT |
List height |
|
IBLOCK_ID |
Identifier of the information block |
|
DEFAULT_VALUE |
Default value |
|
ACTIVE_FILTER |
Show only active elements. Possible values:
|
|
Name |
Description |
|
ENTITY_TYPE |
CRM directory. Structure is similar to the returned elements of the method |
|
Name |
Description |
|
LEAD |
Whether binding to Leads is enabled |
|
CONTACT |
Whether binding to Contacts is enabled |
|
COMPANY |
Whether binding to Companies is enabled |
|
DEAL |
Whether binding to Deals is enabled |
|
ORDER |
Whether binding to Orders is enabled |
|
QUOTE |
Whether binding to Estimates is enabled |
|
SMART_INVOICE |
Whether binding to New Invoices is enabled |
|
DYNAMIC_... |
Whether binding to a specific SPA is enabled. Each such field has the form: |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. The value of this field has the format:
For example: |
|
Name |
Description |
|
SHOW_MAP |
Show map |
|
Name |
Description |
|
POPUP |
Open in a new window |
|
SIZE |
Input field size for display |
|
MIN_LENGTH |
Minimum string length (0 — do not check) |
|
MAX_LENGTH |
Maximum string length (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
ROWS |
Number of lines in the input field |
|
Name |
Description |
|
SIZE |
Input field size for display |
|
LIST_WIDTH |
Maximum width for display in the list |
|
LIST_HEIGHT |
Maximum height for display in the list |
|
MAX_SHOW_SIZE |
Maximum allowed size for display in the list (0 — no limit) |
|
MAX_ALLOWED_SIZE |
Maximum allowed file size for upload (0 — do not check) |
|
EXTENSIONS |
Allowed extensions |
|
TARGET_BLANK |
Open file in a new tab |
Type uf_enum_element
|
Name |
Description |
|
ID |
Identifier of the list element |
|
VALUE |
Value of the list element |
|
SORT |
Sort index |
|
DEF |
Indicates whether the list element is the default value. Possible values:
|
Error Handling
HTTP Status: 400
{
"error": "",
"error_description": "ID is not defined or invalid."
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Description |
Value |
|
|
|
Occurs when:
|
|
|
|
The provided |
|
|
|
The custom field with the provided |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Create a Custom Field for Contacts crm.contact.userfield.add
- Update Existing Custom Contact Field crm.contact.userfield.update
- Get a list of custom fields for contacts crm.contact.userfield.list
- Delete Custom Contact Field crm.contact.userfield.delete