catalog.document.add
Scope: catalog Permissions to execute: for all
catalog.document.add(fields)
Method adds an inventory management object/item Types objects. .
Returns item ID on success.
Parameters
Parameter | Тype | Description |
---|---|---|
fields | array | 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', // vendor. Fields is used only in case when vendors are handled outside of CRM (via website). // Checking vendors provider (in case when using CRM): \Bitrix\Catalog\v2\Contractor\Provider\Manager::isActiveProviderByModule('crm') 'responsibleId': '1', // responsible person ID, 'dateModify': '2000-01-01T00:00:00+02:00', 'dateCreate': '2000-01-01T00:00:00+02:00', 'createdBy': '1', 'modifiedBy': '1', 'currency': 'USD', //employed currency, '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 object.', //comment 'title': 'New object', //title (field is available from catalog 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 object.', 'title' => 'New object', ], ] ); echo '<pre>'; print_r($result); echo '</pre>';
© «Bitrix24», 2001-2024