Create a custom field for invoices crm.invoice.userfield.add

Scope: crm

Who can execute the method: any user

Warning

The method is deprecated. It is recommended to use Universal methods for invoices

The method creates a new custom field for invoices.

The system limitation on the field name is 20 characters. The custom field name always has the prefix UF_CRM_, meaning the actual length of the name is 13 characters.

Method parameters

Required parameters are marked with *

Name
type

Description

fields

A set of fields - an array of the form array("field"=>"value"[, ...]), containing the description of the custom field. A complete description of the fields can be obtained by calling the method crm.userfield.fields.

LIST

Contains a set of list values for custom fields of type List. It is specified when creating/updating the field. Each value is an array with the fields:

  • VALUE - the value of the list item. This field is required when creating a new item.
  • SORT - sorting.
  • DEF - if equal to Y, the list item is the default value. For multiple fields, multiple DEF=Y are allowed. For non-multiple fields, the first will be considered default.
  • XML_ID - external code of the value. This parameter is considered only when updating already existing list item values.
  • ID - the identifier of the value. If specified, it is considered an update of an existing list item value, not the creation of a new one. It only makes sense when calling the methods *.userfield.update.
  • DEL - if equal to Y, the existing list item will be deleted. It is applied if the ID parameter is filled.

Code examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"order":{"SORT":"ASC"},"filter":{"%NAME":"Estimate"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.paysystem.list  
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"order":{"SORT":"ASC"},"filter":{"%NAME":"Estimate"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.paysystem.list
        
// callListMethod: Retrieves all data at once. Use only for small selections (< 1000 items) due to high memory usage.
        
        try {
          const response = await $b24.callListMethod(
            'crm.paysystem.list',
            {
              order: {"SORT": "ASC"},
              filter: {
                "%NAME": "Estimate",
              }
            },
            (progress) => { console.log('Progress:', progress) }
          )
          const items = response.getData() || []
          for (const entity of items) { console.log('Entity:', entity) }
        } catch (error) {
          console.error('Request failed', error)
        }
        
        // fetchListMethod: Retrieves data in parts using an iterator. Use it for large data volumes to optimize memory usage.
        
        try {
          const generator = $b24.fetchListMethod('crm.paysystem.list', {
            order: {"SORT": "ASC"},
            filter: {
              "%NAME": "Estimate",
            }
          }, 'ID')
          for await (const page of generator) {
            for (const entity of page) { console.log('Entity:', entity) }
          }
        } catch (error) {
          console.error('Request failed', error)
        }
        
        // callMethod: Manually controls pagination through the start parameter. Use it for precise control of request batches. For large datasets, it is less efficient than fetchListMethod.
        
        try {
          const response = await $b24.callMethod('crm.paysystem.list', {
            order: {"SORT": "ASC"},
            filter: {
              "%NAME": "Estimate",
            }
          }, 0)
          const result = response.getData().result || []
          for (const entity of result) { console.log('Entity:', entity) }
        } catch (error) {
          console.error('Request failed', error)
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.paysystem.list',
                    [
                        'order' => ['SORT' => 'ASC'],
                        'filter' => [
                            '%NAME' => 'Estimate',
                        ],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            if ($response->more()) {
                $response->next();
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error listing payment systems: ' . $e->getMessage();
        }
        
BX24.callMethod(
            "crm.paysystem.list", {
                order: {"SORT": "ASC"},
                filter: {
                    "%NAME": "Estimate",
                }
            },
            function (result)
            {
                if (result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.dir(result.data());
                    if (result.more())
                        result.next();
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.paysystem.list',
            [
                'order' => ['SORT' => 'ASC'],
                'filter' => ['%NAME' => 'Estimate']
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';