1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$dealId = 123; \Bitrix\Main\Loader::includeModule('crm'); $result = \Bitrix\Crm\ActivityTable::query() ->where('OWNER_ID', $dealId) ->where('OWNER_TYPE_ID', \CCrmOwnerType::Deal) ->where('IS_EMAIL_IN', 1) ->setSelect(['SUBJECT']) ->setOrder(['ID' => 'ASC']) ->setLimit(1) ->exec() ->fetch(); var_dump($result); /* array(1) { ["SUBJECT"]=> string(12) "Заказ 1" } */ |