How to get ComponentEntity by name


How can I get ComponentEntity by name and return it native EntityId. I would like to do FindEntityByName for ComponentEntity as is for legacy Entities in Flow Graph (which not works with ComponentEntity).

I triet to do this like that:

EBUS_EVENT(AZ::ComponentApplicationBus, EnumerateEntities, [&entityName, &found, &pActInfo](AZ::Entity* entity)

if (!found && entity->GetName().compare(entityName) == 0)


found = true;

AZStd::string entId = entity->GetId().ToString();

string entIdStr = entId.c_str();

ActivateOutput(pActInfo, FLOW_OUT_ENTITY_ID, entIdStr);


But its looks like this return different values in compare to EntityId Flow Node so it is not working correctly. Do you have any idea how to fix it ?