для поиска родителя элемента СмП с фильтрацией по сущностям лучше использовать метод [I]EntityRelationTable::getChildElements(ItemIdentifier $parent, int $childEntityTypeId)[/I]
соответственно код:[CODE]$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);
...
...
}
[/CODE]
/up извиняюсь, это получение IDшников дочерних элементов
родителя можно найти через код:
[CODE]$childEntityType = new ItemIdentifier({=Variable:entityTypeId}, {{ID}});
$dealId = StorageStrategy\EntityRelationTable::getParentElements($childEntityType, \CCrmOwnerType::Deal)[0]->getEntityId();
[/CODE]где {{ID}} — это айдишник элемента СмП
конструктор БП пока не совсем приспособлен к работе со Смарт-Процессами
и адаптируют, возможно, только к следующему большому апдейту