:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): search invocations by person email (#70334)
Meikel Ratzbb56bb4423bf
diff --git a/frontend/src/scenes/hog-functions/invocations/HogInvocations.tsx b/frontend/src/scenes/hog-functions/invocations/HogInvocations.tsxindex 92b931538655..b00356b8059b 100644--- a/frontend/src/scenes/hog-functions/invocations/HogInvocations.tsx+++ b/frontend/src/scenes/hog-functions/invocations/HogInvocations.tsx@@ -476,7 +476,7 @@ export function HogInvocations({ id, functionKind, renderLogMessage }: HogInvoca<LemonInputtype="search"size="small"- placeholder="Search by invocation, event, distinct, or person ID…"+ placeholder="Search by invocation, event, distinct ID, person ID, or email…"fullWidthvalue={filters.search ?? ''}onChange={(value) => setFilters({ search: value || undefined })}diff --git a/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx b/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsxindex 820d8f52183e..31ffeaa501aa 100644--- a/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx+++ b/frontend/src/scenes/hog-functions/invocations/hogInvocationsLogic.tsx@@ -385,6 +385,13 @@ async function fetchSparkline(props: HogInvocationsLogicProps, filters: HogInvoc? hogql.raw(`AND error_kind IN (${filters.error_kind.map(escapeHogQLString).join(',')})`): hogql.raw('')const trimmedSearch = filters.search?.trim()+ // Email is stored on `persons.properties.email`, not on `hog_invocation_results` —+ // resolve to person_ids via an `ILIKE %value%` subquery on `persons`. Runs on every+ // non-empty search so partial matches (`meikel`, `@company.com`) work without the user+ // having to type a full email.+ const emailSearchClause = trimmedSearch+ ? `OR person_id IN (SELECT id FROM persons WHERE properties.email ILIKE ${escapeHogQLString(`%${trimmedSearch}%`)})`+ : ''const optionalSearchClause = trimmedSearch? hogql.raw(`AND (@@ -392,6 +399,7 @@ async function fetchSparkline(props: HogInvocationsLogicProps, filters: HogInvocOR event_uuid = ${escapeHogQLString(trimmedSearch)}OR distinct_id = ${escapeHogQLString(trimmedSearch)}OR person_id = ${escapeHogQLString(trimmedSearch)}+ ${emailSearchClause})`): hogql.raw('')@@ -476,6 +484,13 @@ async function fetchRunsPage(? hogql.raw(`AND error_kind IN (${filters.error_kind.map(escapeHogQLString).join(', ')})`): hogql.raw('')const trimmedSearch = filters.search?.trim()+ // Email is stored on `persons.properties.email`, not on `hog_invocation_results` —+ // resolve to person_ids via an `ILIKE %value%` subquery on `persons`. Runs on every+ // non-empty search so partial matches (`meikel`, `@company.com`) work without the user+ // having to type a full email.+ const emailSearchClause = trimmedSearch+ ? `OR person_id IN (SELECT id FROM persons WHERE properties.email ILIKE ${escapeHogQLString(`%${trimmedSearch}%`)})`+ : ''const optionalSearchClause = trimmedSearch? hogql.raw(`AND (@@ -483,6 +498,7 @@ async function fetchRunsPage(OR event_uuid = ${escapeHogQLString(trimmedSearch)}OR distinct_id = ${escapeHogQLString(trimmedSearch)}OR person_id = ${escapeHogQLString(trimmedSearch)}+ ${emailSearchClause})`): hogql.raw('')