Documentation

userfieldconfig.add

Description and parameters

userfieldconfig.add({moduleId: string, field: {}})

Method adds new custom field.

Parameters

Class Description Available from version
moduleId Module string ID. Required.
field List with new field settings:
  • [link=14470968]entityId[/link] - entity string ID. Required.
  • fieldName - field code. Must be generated by template UF_ + {entity ID} + _ + {arbitrary string in UPPER_CASE}. Field code cannot exceed 50 characters. Required field.
  • userTypeId - string identifier for field type. Required.
  • xmlId - external identifier.
  • sort - sorting index.
  • multiple - multiplicity flag (N or Y), N by default. This flag can be specified only when creating a field.
  • mandatory - multiplicity flag (N or Y), N by default.
  • showFilter - flag to show field in filter (N or Y), N by default.
  • showInList - flag to show field in list (N или Y), Y by default.
  • editInList - flag for permitting field editing in the list (N or Y), Y by default.
  • isSearchable - flag for field availability in fulltext index Add fields that you really need to this list. Index-generating upon each field update is a time-consuming process that can significantly slow down operation with large number of such fields. (N or Y), N by default.
  • settings - list with additional field settings.
  • editFormLabel - list with language-dependent field names, where key - language ID, and value - phrase.
  • enum - array with value variants for "list" property type:
    • value - variant value. Required
    • def - flag for default value (N or Y), N by default. Only one variant can be by default
    • sort - sort index. When not selected, is generated automatically based on sequence of passed value variants
    • xmlId - variant external ID

Returned value and example

Returned value

Method returns the same data as the method userfieldconfig.get for newly created field.

Examples

Example of standard query. This query is sufficient for creating "string" field type.

{
    "moduleId": "rpa",
    "field": {
        "entityId": "RPA_1",
        "fieldName": "UF_RPA_1_NEW_REST_STRING",
        "userTypeId": "string",
    } 
}

Creating "list" field type

{
    "moduleId": "rpa",
    "field": {
        "entityId": "RPA_1",
        "fieldName": "UF_RPA_1_NEW_REST_STRING",
        "userTypeId": "enumeration"
    } 
}

© «Bitrix24», 2001-2024
Up