• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/item.php
  • Класс: Bitrix\Crm\Item
  • Вызов: Item::getDefaultValue
public function getDefaultValue(string $commonFieldName)
{
	$implementation = $this->getImplementation($commonFieldName);
	if ($implementation)
	{
		return $implementation->getDefaultValue($commonFieldName);
	}

	if($this->hasFieldInEntityObject($commonFieldName))
	{
		$entityFieldName = $this->getEntityFieldNameByMap($commonFieldName);

		$field = $this->entityObject->sysGetEntity()->getField($entityFieldName);

		if ($field instanceof ScalarField)
		{
			return $field->getDefaultValue();
		}

		if ($field instanceof UserTypeField && $field->getValueField() instanceof ScalarField)
		{
			return $field->getValueField()->getDefaultValue();
		}
	}

	return null;
}