Documentation

catalog.document.add

catalog.document.add(fields)

Method adds an inventory management item.

Returns item ID on success.

Parameters

ParameterТype Description
fieldsarray Added item parameters. Fields match to the available list of fields.

Example

BX24.callMethod(
    'catalog.document.add', 
    {
        'fields': {
            'docType': 'S', //\CCatalogDocsTypes::TYPE_STORE_ADJUSTMENT, type - stock adjustment
            'contractorId': '1', // supplier 
            'responsibleId': '1', // responsible user ID,
            'dateModify': '2000-01-01T00:00:00+02:00',
            'dateCreate': '2000-01-01T00:00:00+02:00',
            'createdBy': '1',
            'modifiedBy': '1',
            'currency': 'USD', //currency used,
            'status': 'S',
            'dateStatus': '2000-01-01T00:00:00+02:00',
            'dateDocument': '2000-01-01T00:00:00+02:00', //DATE_ATOM
            'statusBy': '1',
            'total': '100',
            'commentary': 'first document.', //comment
            'title': 'New item', //title (field ia available from catalog version 22.200.0)

        }
    }, 
    function(result)
    {
        if(result.error())
            console.error(result.error());
        else
            console.log(result.data());
    }
);
$result = CRest::call(
    'catalog.document.add',
    [
        'fields' => [
            'docType' => 'S',
            'contractorId' => '1',
            'responsibleId' => '1',
            'dateModify' => '2000-01-01T00:00:00+02:00',
            'dateCreate' => '2000-01-01T00:00:00+02:00',
            'createdBy' => '1',
            'modifiedBy' => '1',
            'currency' => 'USD',
            'status' => 'S',
            'dateStatus' => '2000-01-01T00:00:00+02:00',
            'dateDocument' => '2000-01-01T00:00:00+02:00',
            'statusBy' => '1',
            'total' => '100',
            'commentary' => 'first document.',
            'title' => 'New item', 

        ],
    ]
);

echo '<pre>';
print_r($result);
echo '</pre>';

© «Bitrix24», 2001-2022
Up