Documentation

crm.product.add

crm.product.add(fields)

Creates a new product.

Parameters

CURRENCY_ID must be specified to set a price.
Note: to find out the required field format, execute the method crm.product.fields to view the retrieved field format.
Parameter Description
fields Set of fields is an array ("field"=>"value"[, ...]), containing values of product fields.

Starting from CRM version 21.700.0 it's now supports automatic generation of product symbolic code on condition that iblock settings has such autogeneration enabled and no external service is employed. Uses the method generateMnemonicCode.

If the generated symbolic code includes more than 100 symbols, it's automatically cropped to 100 symbols/characters. This must be considered when creating queries, when passing a unique value at the product name start/middle to avoid matching symbolic codes.


Example

 BX24.callMethod(
   "crm.product.add", 
   {
    fields:
    { 
     "NAME": "Bitrix24, Inc.", 
     "CURRENCY_ID": "USD", 
     "PRICE": 4900, 
     "SORT": 500
    }
   }, 
   function(result) 
   {
    if(result.error())
     console.error(result.error());
    else
     console.info("New product with ID " + result.data() "created");
   }
  ); 

Adding files to CRM by the highlighted method has its own particular specifics.



© «Bitrix24», 2001-2023
Up