Documentation

lists.field.update

Scope: catalog Permissions to execute: for all

lists.field.update (params, fields)

This method updates the list field. Returns true on success, otherwise throws an exception.

Parameters

ParameterDescription
IBLOCK_TYPE_ID information block type ID (required):
  • lists - information block type for lists
  • bitrix_processes - information block type for processes
  • lists_socnet - information block type for workgroup lists
IBLOCK_CODE/IBLOCK_IDcode or ID for information block (required);
SOCNET_GROUP_IDgroup ID (required, for a group list);
FIELD_IDField ID. (required. If information block property field, then format is: "PROPERTY_propertyId")
FIELDS (key are the same as when creating field from Bitrix24 interface)
  • NAME name (required)
  • IS_REQUIRED required mark
  • MULTIPLE multiple mark
  • TYPE type (required)
  • SORT sorting
  • DEFAULT_VALUE value by default
  • LIST - can be used to add value of the "List" type field.
    • n0 - item string
      • SORT - sorting value
      • VALUE - item value
  • LIST_TEXT_VALUES - can be used to add "List" field type values via the string (Each unique string will become a separate list value)
  • LIST_DEF - by default value for "List" type field (Format: array with the value, with list item ID value)
  • CODE code (required, if the field is information block property)
  • SETTINGS all keys shall be available, otherwise, overwrite by default values will occur
    • SHOW_ADD_FORM - show in the add form
    • SHOW_EDIT_FORM - show in the edit form
    • ADD_READ_ONLY_FIELD - read only (add form)
    • EDIT_READ_ONLY_FIELD - read only (edit form)
    • SHOW_FIELD_PREVIEW - show field when forming link for a list element
  • USER_TYPE_SETTINGS - key to pass user settings
  • ROW_COUNT/COL_COUNT - settings for textarea fields
  • LINK_IBLOCK_ID - linked section ID

Example

    var params = {
        'IBLOCK_TYPE_ID': 'lists_socnet',
        'IBLOCK_CODE': 'rest_1',
        'FIELD_ID': 'PROPERTY_61',
        'FIELDS': {
            'NAME': 'List field (Update)',
            'IS_REQUIRED': 'N',
            'MULTIPLE': 'N',
            'TYPE': 'L',
            'SORT': '20',
            'CODE': 'fieldList',
            'LIST': {
                '58': {
                    'SORT': '10',
                    'VALUE': 'one'
                },
                '59': {
                    'SORT': '20',
                    'VALUE': 'two'
                },
                '60': {
                    'SORT': '30',
                    'VALUE': 'three'
                }
            },
            'LIST_DEF': { 
                '0': '59'
            },
            'SETTINGS': {
                'SHOW_ADD_FORM': 'Y',
                'SHOW_EDIT_FORM': 'Y',
                'ADD_READ_ONLY_FIELD': 'N',
                'EDIT_READ_ONLY_FIELD': 'Y',
                'SHOW_FIELD_PREVIEW': 'N'
            }
        }
    };
    BX24.callMethod(
        'lists.field.update',
        params,
        function(result)
        {
            if(result.error())
                alert("Error: " + result.error());
            else
                alert("Success: " + result.data());
        }
    );


© «Bitrix24», 2001-2024