для поиска родителя элемента СмП с фильтрацией по сущностям лучше использовать метод EntityRelationTable::getChildElements(ItemIdentifier $parent, int $childEntityTypeId)
соответственно код:
Код |
---|
$rootActivity = $this->GetRootActivity(); use Bitrix\Crm\Item; use Bitrix\Crm\Service; use Bitrix\Crm\Relation; use Bitrix\Crm\ItemIdentifier; use Bitrix\Crm\Service\Container; use Bitrix\Crm\Relation\StorageStrategy; Bitrix\Main\Loader::includeModule("crm"); $parent = new ItemIdentifier(\CCrmOwnerType::Deal, {=Variable:IdDeal}); $childEntity = StorageStrategy\EntityRelationTable::getChildElements($parent, {=Variable:entityTypeId}); foreach ($childEntity as $entityId) { $entitySmPId = $entityId->getEntityId(); $item = Service\Container::getInstance()->getFactory({=Variable:entityTypeId})->getItem($entitySmPId); ... ... } |
/up извиняюсь, это получение IDшников дочерних элементов
родителя можно найти через код:
Код |
---|
$childEntityType = new ItemIdentifier({=Variable:entityTypeId}, {{ID}}); $dealId = StorageStrategy\EntityRelationTable::getParentElements($childEntityType, \CCrmOwnerType::Deal)[0]->getEntityId(); |
конструктор БП пока не совсем приспособлен к работе со Смарт-Процессами
и адаптируют, возможно, только к следующему большому апдейту