Add Product Property crm.product.property.add
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
Scope:
crmWho can execute the method: administrator, user with the "Allow to modify settings" access permission in CRM
DEPRECATED
The development of this method has been halted. Please use catalog.productProperty.add.
The method crm.product.property.add creates a new product property.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
fields |
Field values for creating the product property. To find out the required format for the fields, execute the method crm.product.property.fields and check the format of the returned field values. |
Code Examples
How to Use Examples in Documentation
Example 1
try
{
const getCatalogId = async () =>
{
try
{
const catalogListResponse = await $b24.callMethod(
"crm.catalog.list",
{filter: {"ORIGINATOR_ID": "", "ORIGIN_ID": ""}}
);
if (catalogListResponse.error())
{
console.error(catalogListResponse.error());
}
else
{
let catalogId = 0;
if (catalogListResponse.total() !== 1)
{
catalogId = 0;
}
else
{
const data = catalogListResponse.getData().result;
if (data && data instanceof Array && typeof(data[0]) === "object" && data[0]["ID"])
{
catalogId = parseInt(data[0]["ID"]);
}
}
if (catalogId <= 0)
{
console.error("Failed to retrieve the CRM product catalog ID");
}
else
{
await addPropertyExample(catalogId);
}
}
}
catch (error)
{
console.error(error);
}
};
const addPropertyExample = async (catalogId) =>
{
try
{
const propertyAddResponse = await $b24.callMethod(
"crm.product.property.add",
{
fields: {
"ACTIVE": "Y",
"IBLOCK_ID": catalogId,
"NAME": "Property - HTML/Text",
"SORT": 500,
"DEFAULT_VALUE": {
"TYPE": "html",
"TEXT": "<u><b>Delicious</b> \"<span style=\"color: #00a650;\">African bananas</span>\"</u>"
},
"USER_TYPE_SETTINGS": {
"HEIGHT": 300
},
"USER_TYPE": "HTML",
"PROPERTY_TYPE": "S"
}
}
);
const result = propertyAddResponse.getData().result;
console.dir(result);
}
catch (error)
{
console.error(error);
}
};
const start = async () =>
{
await getCatalogId();
};
start();
}
catch (error)
{
console.error(error);
}
try {
$responseCatalog = $b24Service
->core
->call(
'crm.catalog.list',
[
'filter' => ['ORIGINATOR_ID' => '', 'ORIGIN_ID' => ''],
]
);
$catalogId = 0;
$resultCatalog = $responseCatalog
->getResponseData()
->getResult();
if ($resultCatalog->total() !== 1) {
$catalogId = 0;
} else {
$data = $resultCatalog->data();
if ($data && is_array($data) && is_object($data[0]) && isset($data[0]["ID"])) {
$catalogId = (int)$data[0]["ID"];
}
}
if ($catalogId <= 0) {
throw new Exception("Failed to retrieve the CRM product catalog ID");
} else {
$responseProperty = $b24Service
->core
->call(
'crm.product.property.add',
[
'fields' => [
'ACTIVE' => 'Y',
'IBLOCK_ID' => $catalogId,
'NAME' => 'Property - HTML/Text',
'SORT' => 500,
'DEFAULT_VALUE' => [
'TYPE' => 'html',
'TEXT' => '<u><b>Delicious</b> "<span style="color: #00a650;">African bananas</span>"</u>',
],
'USER_TYPE_SETTINGS' => [
'HEIGHT' => 300,
],
'USER_TYPE' => 'HTML',
'PROPERTY_TYPE' => 'S',
],
]
);
$resultProperty = $responseProperty
->getResponseData()
->getResult();
echo 'Success: ' . print_r($resultProperty, true);
// Your data processing logic
processData($resultProperty);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding product property: ' . $e->getMessage();
}
// Creating a custom property of type S:HTML
function addPropertyExample(catalogId)
{
BX24.callMethod(
"crm.product.property.add",
{
fields: {
"ACTIVE": "Y",
"IBLOCK_ID": catalogId,
"NAME": "Property - HTML/Text",
"SORT": 500,
"DEFAULT_VALUE": {
"TYPE": "html",
"TEXT": "<u><b>Delicious</b> \"<span style=\"color: #00a650;\">African bananas</span>\"</u>"
},
"USER_TYPE_SETTINGS": {
"HEIGHT": 300
},
"USER_TYPE": "HTML",
"PROPERTY_TYPE": "S"
}
},
function(result)
{
if(result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
}
function getCatalogId()
{
BX24.callMethod(
"crm.catalog.list",
{filter: {"ORIGINATOR_ID": "", "ORIGIN_ID": ""}},
function(result)
{
if(result.error())
{
console.error(result.error());
}
else
{
var catalogId = 0;
if (result.total() !== 1)
{
catalogId = 0
}
else
{
data = result.data();
if (data && data instanceof Array && typeof(data[0]) === "object" && data[0]["ID"])
{
catalogId = parseInt(data[0]["ID"]);
}
}
if (catalogId <= 0)
{
console.error("Failed to retrieve the CRM product catalog ID");
}
else
{
addPropertyExample(catalogId);
}
}
}
);
}
function start()
{
getCatalogId();
}
start();
require_once('crest.php');
// Function to add a custom property
function addPropertyExample($catalogId) {
$result = CRest::call(
'crm.product.property.add',
[
'fields' => [
'ACTIVE' => 'Y',
'IBLOCK_ID' => $catalogId,
'NAME' => 'Property - HTML/Text',
'SORT' => 500,
'DEFAULT_VALUE' => [
'TYPE' => 'html',
'TEXT' => '<u><b>Delicious</b> "<span style="color: #00a650;">African bananas</span>"</u>'
],
'USER_TYPE_SETTINGS' => [
'HEIGHT' => 300
],
'USER_TYPE' => 'HTML',
'PROPERTY_TYPE' => 'S'
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
}
// Function to get catalog ID
function getCatalogId() {
$result = CRest::call(
'crm.catalog.list',
['filter' => ['ORIGINATOR_ID' => '', 'ORIGIN_ID' => '']]
);
if ($result['error']) {
echo 'Error: ' . $result['error_description'];
} else {
$catalogId = 0;
if ($result['total'] !== 1) {
$catalogId = 0;
} else {
$data = $result['result'];
if ($data && is_array($data) && isset($data[0]['ID'])) {
$catalogId = intval($data[0]['ID']);
}
}
if ($catalogId <= 0) {
echo "Failed to retrieve the CRM product catalog ID";
} else {
addPropertyExample($catalogId);
}
}
}
// Start the process
getCatalogId();
Example 2
try
{
const getCatalogId = async () =>
{
try
{
const response = await $b24.callMethod(
"crm.catalog.list",
{filter: {"ORIGINATOR_ID": "", "ORIGIN_ID": ""}}
);
if(response.error())
{
console.error(response.error());
}
else
{
let catalogId = 0;
if (response.total() !== 1)
{
catalogId = 0;
}
else
{
const data = response.getData().result;
if (data && data instanceof Array && typeof(data[0]) === "object" && data[0]["ID"])
{
catalogId = parseInt(data[0]["ID"]);
}
}
if (catalogId <= 0)
{
console.error("Failed to retrieve the CRM product catalog ID");
}
else
{
await addPropertyExample(catalogId);
}
}
}
catch(error)
{
console.error(error);
}
};
const addPropertyExample = async (catalogId) =>
{
try
{
const response = await $b24.callMethod(
"crm.product.property.add",
{
fields: {
"ACTIVE": "Y",
"IBLOCK_ID": catalogId,
"NAME": "Property - List",
"SORT": 510,
"MULTIPLE": "Y",
"ROW_COUNT": 7,
"LIST_TYPE": "L",
"PROPERTY_TYPE": "L",
"VALUES": {
"n0": {
"ID": "n0",
"VALUE": "List value 1",
"SORT": 100,
"DEF": "Y"
},
"n1": {
"ID": "n1",
"VALUE": "List value 2",
"SORT": 200,
"DEF": "N"
},
"n2": {
"ID": "n2",
"VALUE": "List value 3",
"SORT": 300,
"DEF": "Y"
},
"n3": {
"ID": "n3",
"VALUE": "List value 4",
"SORT": 400,
"DEF": "N"
},
"n4": {
"ID": "n4",
"VALUE": "List value 5",
"SORT": 500,
"DEF": "N"
},
"n5": {
"ID": "n5",
"VALUE": "List value 6",
"SORT": 600,
"DEF": "N"
},
"n6": {
"ID": "n6",
"VALUE": "List value 7",
"SORT": 700,
"DEF": "N"
},
"n7": {
"ID": "n7",
"VALUE": "List value 8",
"SORT": 800,
"DEF": "N"
}
}
}
}
);
console.dir(response.getData().result);
}
catch(error)
{
console.error(error);
}
};
const start = async () =>
{
await getCatalogId();
};
start();
}
catch(error)
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'crm.catalog.list',
[
'filter' => ['ORIGINATOR_ID' => '', 'ORIGIN_ID' => ''],
]
);
if ($response->getError()) {
error_log($response->getError());
echo 'Error getting catalog list: ' . $response->getError();
} else {
$catalogId = 0;
$result = $response->getResponseData()->getResult();
if ($result->total() !== 1) {
$catalogId = 0;
} else {
$data = $result->getData();
if ($data && is_array($data) && is_object($data[0]) && isset($data[0]["ID"])) {
$catalogId = (int)$data[0]["ID"];
}
}
if ($catalogId <= 0) {
error_log("Failed to retrieve the CRM product catalog ID");
echo "Failed to retrieve the CRM product catalog ID";
} else {
$response = $b24Service
->core
->call(
'crm.product.property.add',
[
'fields' => [
'ACTIVE' => 'Y',
'IBLOCK_ID' => $catalogId,
'NAME' => 'Property - List',
'SORT' => 510,
'MULTIPLE' => 'Y',
'ROW_COUNT' => 7,
'LIST_TYPE' => 'L',
'PROPERTY_TYPE' => 'L',
'VALUES' => [
'n0' => [
'ID' => 'n0',
'VALUE' => 'List value 1',
'SORT' => 100,
'DEF' => 'Y',
],
'n1' => [
'ID' => 'n1',
'VALUE' => 'List value 2',
'SORT' => 200,
'DEF' => 'N',
],
'n2' => [
'ID' => 'n2',
'VALUE' => 'List value 3',
'SORT' => 300,
'DEF' => 'Y',
],
'n3' => [
'ID' => 'n3',
'VALUE' => 'List value 4',
'SORT' => 400,
'DEF' => 'N',
],
'n4' => [
'ID' => 'n4',
'VALUE' => 'List value 5',
'SORT' => 500,
'DEF' => 'N',
],
'n5' => [
'ID' => 'n5',
'VALUE' => 'List value 6',
'SORT' => 600,
'DEF' => 'N',
],
'n6' => [
'ID' => 'n6',
'VALUE' => 'List value 7',
'SORT' => 700,
'DEF' => 'N',
],
'n7' => [
'ID' => 'n7',
'VALUE' => 'List value 8',
'SORT' => 800,
'DEF' => 'N',
],
],
],
]
);
$result = $response->getResponseData()->getResult();
echo 'Success: ' . print_r($result, true);
}
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error: ' . $e->getMessage();
}
function addPropertyExample(catalogId)
{
BX24.callMethod(
"crm.product.property.add",
{
fields: {
"ACTIVE": "Y",
"IBLOCK_ID": catalogId,
"NAME": "Property - List",
"SORT": 510,
"MULTIPLE": "Y",
"ROW_COUNT": 7,
"LIST_TYPE": "L",
"PROPERTY_TYPE": "L",
"VALUES": {
"n0": {
"ID": "n0",
"VALUE": "List value 1",
"SORT": 100,
"DEF": "Y"
},
"n1": {
"ID": "n1",
"VALUE": "List value 2",
"SORT": 200,
"DEF": "N"
},
"n2": {
"ID": "n2",
"VALUE": "List value 3",
"SORT": 300,
"DEF": "Y"
},
"n3": {
"ID": "n3",
"VALUE": "List value 4",
"SORT": 400,
"DEF": "N"
},
"n4": {
"ID": "n4",
"VALUE": "List value 5",
"SORT": 500,
"DEF": "N"
},
"n5": {
"ID": "n5",
"VALUE": "List value 6",
"SORT": 600,
"DEF": "N"
},
"n6": {
"ID": "n6",
"VALUE": "List value 7",
"SORT": 700,
"DEF": "N"
},
"n7": {
"ID": "n7",
"VALUE": "List value 8",
"SORT": 800,
"DEF": "N"
}
}
}
},
function(result)
{
if(result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
}
function getCatalogId()
{
BX24.callMethod(
"crm.catalog.list",
{filter: {"ORIGINATOR_ID": "", "ORIGIN_ID": ""}},
function(result)
{
if(result.error())
{
console.error(result.error());
}
else
{
var catalogId = 0;
if (result.total() !== 1)
{
catalogId = 0
}
else
{
data = result.data();
if (data && data instanceof Array && typeof(data[0]) === "object" && data[0]["ID"])
{
catalogId = parseInt(data[0]["ID"]);
}
}
if (catalogId <= 0)
{
console.error("Failed to retrieve the CRM product catalog ID");
}
else
{
addPropertyExample(catalogId);
}
}
}
);
}
function start()
{
getCatalogId();
}
start();
require_once('crest.php');
function addPropertyExample($catalogId) {
$result = CRest::call(
'crm.product.property.add',
[
'fields' => [
'ACTIVE' => 'Y',
'IBLOCK_ID' => $catalogId,
'NAME' => 'Property - List',
'SORT' => 510,
'MULTIPLE' => 'Y',
'ROW_COUNT' => 7,
'LIST_TYPE' => 'L',
'PROPERTY_TYPE' => 'L',
'VALUES' => [
'n0' => [
'ID' => 'n0',
'VALUE' => 'List value 1',
'SORT' => 100,
'DEF' => 'Y'
],
'n1' => [
'ID' => 'n1',
'VALUE' => 'List value 2',
'SORT' => 200,
'DEF' => 'N'
],
'n2' => [
'ID' => 'n2',
'VALUE' => 'List value 3',
'SORT' => 300,
'DEF' => 'Y'
],
// Continue for other values...
]
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
}
function getCatalogId() {
$result = CRest::call(
'crm.catalog.list',
['filter' => ['ORIGINATOR_ID' => '', 'ORIGIN_ID' => '']]
);
if (isset($result['error'])) {
echo 'Error: ' . $result['error_description'];
} else {
$catalogId = 0;
if (count($result['result']) !== 1) {
echo "Failed to retrieve the CRM product catalog ID";
} else {
$data = $result['result'];
if (isset($data[0]['ID'])) {
$catalogId = intval($data[0]['ID']);
addPropertyExample($catalogId);
}
}
}
}
getCatalogId();