- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/tracking/internals/sourcefield.php
- Класс: Bitrix\Crm\Tracking\Internals\SourceFieldTable
- Вызов: SourceFieldTable::setSourceField
static function setSourceField($sourceId, $code, array $values)
{
if (!$sourceId || !$code)
{
return;
}
$existedList = static::getList([
'select' => ['ID'],
'filter' => ['=SOURCE_ID' => $sourceId, '=CODE' => $code]
]);
foreach ($existedList as $existed)
{
static::delete($existed['ID']);
}
foreach ($values as $value)
{
if (!$value)
{
continue;
}
static::add([
'SOURCE_ID' => $sourceId,
'CODE' => $code,
'VALUE' => $value,
]);
}
}