Skip to content

: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.

feat(customer-analytics): back accounts assigned/unassigned filters by relationships (#68997)

Arthur Moreira de Deus0db9914bd8c1
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 906c649d022a..d5da32ed6a2b 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -26,10 +26,11 @@
"additionalProperties": false,
"properties": {
"allRolesUnassigned": {
+ "description": "Match accounts with no active relationship of any definition.",
"type": "boolean"
},
"assignedToUserIds": {
- "description": "Match accounts where any of these user ids is the CSM or the account executive (OR over both roles). Drives the \"My accounts\" shortcut (the current user's id) and the shareable \"Assigned to\" filter — the ids are explicit so a shared URL resolves identically for every viewer.",
+ "description": "Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the \"My accounts\" shortcut (the current user's id) and the shareable \"Assigned to\" filter — the ids are explicit so a shared URL resolves identically for every viewer.",
"items": {
"$ref": "#/definitions/integer"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 1ef7f9905112..7629df561006 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -2425,8 +2425,9 @@ export interface AccountsQuery extends DataNode<AccountsQueryResponse> {
metrics?: HogQLExpression[]
search?: string
tagNames?: string[]
- /** Match accounts where any of these user ids is the CSM or the account executive (OR over both roles). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
+ /** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: integer[]
+ /** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
filterExpression?: HogQLExpression
diff --git a/posthog/schema.py b/posthog/schema.py
index db3b238c3a11..bab7e95ed364 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -22069,14 +22069,18 @@ class AccountsQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
- allRolesUnassigned: bool | None = None
+ allRolesUnassigned: bool | None = Field(
+ default=None,
+ description="Match accounts with no active relationship of any definition.",
+ )
assignedToUserIds: list[int] | None = Field(
default=None,
description=(
- "Match accounts where any of these user ids is the CSM or the account"
- ' executive (OR over both roles). Drives the "My accounts" shortcut (the'
- ' current user\'s id) and the shareable "Assigned to" filter — the ids are'
- " explicit so a shared URL resolves identically for every viewer."
+ "Match accounts where any of these user ids actively holds any relationship"
+ ' (CSM, Account executive, or a custom definition). Drives the "My'
+ ' accounts" shortcut (the current user\'s id) and the shareable "Assigned'
+ ' to" filter — the ids are explicit so a shared URL resolves identically'
+ " for every viewer."
),
)
filterExpression: str | None = Field(
diff --git a/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py b/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py
index 22d67ac5a83b..850e1208a2be 100644
--- a/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py
+++ b/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py
@@ -26,16 +26,6 @@ def _normalize_order_clause(raw: str) -> str:
return stripped
-# Account-properties JSON keys for the three assignable roles. The
-# `allRolesUnassigned` filter ("Unassigned only") requires every one of these to
-# be empty.
-ROLE_JSON_KEYS = ("csm", "account_executive", "account_owner")
-
-# Roles that count as "assigned" for the `assignedToUserIds` filter — an account
-# is assigned to a user if they are its CSM or account executive.
-ASSIGNED_ROLE_KEYS = ("csm", "account_executive")
-
-
class AccountsQueryRunner(AnalyticsQueryRunner[AccountsQueryResponse]):
query: AccountsQuery
cached_response: CachedAccountsQueryResponse
@@ -114,11 +104,17 @@ class AccountsQueryRunner(AnalyticsQueryRunner[AccountsQueryResponse]):
where_exprs.append(self._tag_filter_expr(self.query.tagNames))
if self.query.allRolesUnassigned:
- for json_key in ROLE_JSON_KEYS:
- where_exprs.append(self._role_id_isnull(json_key))
+ where_exprs.append(
+ parse_expr("id NOT IN {subquery}", {"subquery": self._active_relationship_account_ids()})
+ )
if self.query.assignedToUserIds:
- where_exprs.append(self._assigned_to_users_expr(self.query.assignedToUserIds))
+ where_exprs.append(
+ parse_expr(
+ "id IN {subquery}",
+ {"subquery": self._active_relationship_account_ids(self.query.assignedToUserIds)},
+ )
+ )
if self.query.filterExpression and self.query.filterExpression.strip():
where_exprs.append(parse_expr(self.query.filterExpression))
@@ -163,47 +159,21 @@ class AccountsQueryRunner(AnalyticsQueryRunner[AccountsQueryResponse]):
)
return parse_expr("id IN {subquery}", {"subquery": subquery})
- def _role_filter_expr(self, json_key: str, value: object) -> ast.Expr | None:
- if not value:
- return None
- raw_values = value if isinstance(value, list) else [value]
- user_ids: list[int] = []
- for raw in raw_values:
- if isinstance(raw, int):
- user_ids.append(raw)
- elif isinstance(raw, str):
- try:
- user_ids.append(int(raw))
- except ValueError:
- continue
- if not user_ids:
- return None
- return parse_expr(
- "JSONExtract(properties, {role_key}, 'id', 'Nullable(Int64)') IN {user_ids}",
- {
- "role_key": ast.Constant(value=json_key),
- "user_ids": ast.Constant(value=user_ids),
- },
- )
-
- def _role_id_isnull(self, json_key: str) -> ast.Expr:
- return parse_expr(
- "isNull(JSONExtract(properties, {role_key}, 'id', 'Nullable(Int64)'))",
- {"role_key": ast.Constant(value=json_key)},
- )
-
- def _assigned_to_users_expr(self, user_ids: list[int]) -> ast.Expr:
- # OR over the CSM/AE roles: an account is "assigned to" a user if they
- # hold either role. Explicit ids (not the requester) so a shared URL
+ def _active_relationship_account_ids(
+ self, user_ids: list[int] | None = None
+ ) -> ast.SelectQuery | ast.SelectSetQuery:
+ # An account is "assigned" when someone actively holds any relationship on
+ # it (CSM, Account executive, or a custom definition) — optionally narrowed
+ # to the given holders. Explicit ids (not the requester) so a shared URL
# filtered by "my accounts" resolves to the same accounts for every viewer.
- role_exprs: list[ast.Expr] = []
- for json_key in ASSIGNED_ROLE_KEYS:
- role_expr = self._role_filter_expr(json_key, user_ids)
- if role_expr is not None:
- role_exprs.append(role_expr)
- if not role_exprs:
- return ast.Constant(value=False)
- return ast.Or(exprs=role_exprs)
+ if user_ids is not None:
+ return parse_select(
+ "SELECT account_id FROM system.account_relationships WHERE isNull(ended_at) AND user_id IN {user_ids}",
+ {"user_ids": ast.Constant(value=user_ids)},
+ )
+ return parse_select(
+ "SELECT account_id FROM system.account_relationships WHERE isNull(ended_at) AND isNotNull(user_id)"
+ )
def _calculate(self) -> AccountsQueryResponse:
metrics_results = self._compute_metrics_results(self.query.metrics) if self.query.metrics else None
diff --git a/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py b/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py
index de354faa36fa..5be8c5c09065 100644
--- a/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py
+++ b/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py
@@ -16,7 +16,8 @@ from posthog.models.team import Team
from posthog.rbac.user_access_control import UserAccessControlError
from products.customer_analytics.backend.hogql_queries.accounts_query_runner import AccountsQueryRunner
-from products.customer_analytics.backend.models import CustomPropertyValue
+from products.customer_analytics.backend.logic import relationships as relationships_logic
+from products.customer_analytics.backend.models import AccountRelationshipDefinition, CustomPropertyValue
from products.customer_analytics.backend.test.factories import create_account, create_custom_property_definition
from products.notebooks.backend.models import Notebook, ResourceNotebook
@@ -143,113 +144,136 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):
self.assertEqual(self._ids(tagNames=["billing"]), [str(local_account.id)])
- @parameterized.expand(
- [
- ("absent_keys", {"_properties": {}}),
- ("null_valued_keys", {"properties": {}}),
- ]
- )
- def test_all_roles_unassigned(self, _name, unassigned_kwargs):
- create_account(team_id=self.team.id, name="Has CSM", properties={"csm": {"id": 7, "email": "[email protected]"}})
- unassigned = create_account(team_id=self.team.id, name="Unassigned", **unassigned_kwargs)
- self.assertEqual(self._ids(allRolesUnassigned=True), [str(unassigned.id)])
+ def _assign(self, account, user, definition_name="CSM"):
+ definition, _ = AccountRelationshipDefinition.objects.for_team(self.team.id).get_or_create(
+ team_id=self.team.id, name=definition_name
+ )
+ return relationships_logic.assign(
+ team_id=self.team.id, account=account, definition=definition, user=user, created_by=user
+ )
+
+ def test_all_roles_unassigned(self):
+ holder = self._create_user("[email protected]")
+ assigned = create_account(team_id=self.team.id, name="Assigned")
+ self._assign(assigned, holder)
+ previously_assigned = create_account(team_id=self.team.id, name="Previously assigned")
+ rel = self._assign(previously_assigned, holder)
+ relationships_logic.end_relationship(team_id=self.team.id, relationship_id=str(rel.id))
+ never_assigned = create_account(team_id=self.team.id, name="Never assigned")
+
+ self.assertEqual(set(self._ids(allRolesUnassigned=True)), {str(previously_assigned.id), str(never_assigned.id)})
def test_combined_assigned_to_and_tags(self):
enterprise_tag = Tag.objects.create(name="enterprise", team=self.team)
startup_tag = Tag.objects.create(name="startup", team=self.team)
+ holder = self._create_user("[email protected]")
+ other_holder = self._create_user("[email protected]")
- match = create_account(team_id=self.team.id, name="A", _properties={"csm": {"id": 7, "email": "[email protected]"}})
+ match = create_account(team_id=self.team.id, name="A")
+ self._assign(match, holder)
match.tagged_items.create(tag=enterprise_tag)
- wrong_tag = create_account(team_id=self.team.id, name="B", _properties={"csm": {"id": 7, "email": "[email protected]"}})
+ wrong_tag = create_account(team_id=self.team.id, name="B")
+ self._assign(wrong_tag, holder)
wrong_tag.tagged_items.create(tag=startup_tag)
- wrong_user = create_account(team_id=self.team.id, name="C", _properties={"csm": {"id": 8, "email": "[email protected]"}})
+ wrong_user = create_account(team_id=self.team.id, name="C")
+ self._assign(wrong_user, other_holder)
wrong_user.tagged_items.create(tag=enterprise_tag)
- self.assertEqual(self._ids(assignedToUserIds=[7], tagNames=["enterprise"]), [str(match.id)])
+ self.assertEqual(self._ids(assignedToUserIds=[holder.id], tagNames=["enterprise"]), [str(match.id)])
@parameterized.expand(
[
- ("csm", "csm"),
- ("account_executive", "account_executive"),
+ ("seeded_csm", "CSM"),
+ ("seeded_account_owner", "Account owner"),
+ ("custom_definition", "Onboarding manager"),
]
)
- def test_assigned_to_user_matches_when_user_holds_role(self, _name, role_key):
- mine = create_account(
- team_id=self.team.id,
- name="Mine",
- _properties={role_key: {"id": 7, "email": "[email protected]"}},
- )
- create_account(
- team_id=self.team.id,
- name="Someone else's",
- _properties={role_key: {"id": 8, "email": "[email protected]"}},
- )
- self.assertEqual(self._ids(assignedToUserIds=[7]), [str(mine.id)])
-
- def test_assigned_to_user_unions_csm_and_account_executive_but_not_owner(self):
- as_csm = create_account(team_id=self.team.id, name="As CSM", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- as_ae = create_account(
- team_id=self.team.id,
- name="As AE",
- _properties={"account_executive": {"id": 7, "email": "[email protected]"}},
- )
- create_account(
- team_id=self.team.id,
- name="As owner only",
- _properties={"account_owner": {"id": 7, "email": "[email protected]"}},
- )
- create_account(team_id=self.team.id, name="Unassigned")
-
- self.assertEqual(
- set(self._ids(assignedToUserIds=[7])),
- {str(as_csm.id), str(as_ae.id)},
- )
+ def test_assigned_to_user_matches_any_actively_held_relationship(self, _name, definition_name):
+ holder = self._create_user("[email protected]")
+ other_holder = self._create_user("[email protected]")
+ mine = create_account(team_id=self.team.id, name="Mine")
+ self._assign(mine, holder, definition_name)
+ someone_elses = create_account(team_id=self.team.id, name="Someone else's")
+ self._assign(someone_elses, other_holder, definition_name)
+ self.assertEqual(self._ids(assignedToUserIds=[holder.id]), [str(mine.id)])
+
+ def test_assigned_to_user_excludes_ended_assignments(self):
+ holder = self._create_user("[email protected]")
+ account = create_account(team_id=self.team.id, name="Handed off")
+ rel = self._assign(account, holder)
+ relationships_logic.end_relationship(team_id=self.team.id, relationship_id=str(rel.id))
+ self.assertEqual(self._ids(assignedToUserIds=[holder.id]), [])
def test_assigned_to_user_matches_any_of_multiple_ids(self):
- as_csm = create_account(team_id=self.team.id, name="CSM 7", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- as_ae = create_account(
- team_id=self.team.id, name="AE 9", _properties={"account_executive": {"id": 9, "email": "[email protected]"}}
- )
- create_account(team_id=self.team.id, name="CSM 11", _properties={"csm": {"id": 11, "email": "[email protected]"}})
- self.assertEqual(set(self._ids(assignedToUserIds=[7, 9])), {str(as_csm.id), str(as_ae.id)})
+ holder_a = self._create_user("[email protected]")
+ holder_b = self._create_user("[email protected]")
+ holder_c = self._create_user("[email protected]")
+ as_csm = create_account(team_id=self.team.id, name="CSM A")
+ self._assign(as_csm, holder_a)
+ as_ae = create_account(team_id=self.team.id, name="AE B")
+ self._assign(as_ae, holder_b, "Account executive")
+ other = create_account(team_id=self.team.id, name="CSM C")
+ self._assign(other, holder_c)
+ self.assertEqual(set(self._ids(assignedToUserIds=[holder_a.id, holder_b.id])), {str(as_csm.id), str(as_ae.id)})
def test_assigned_to_user_is_independent_of_requesting_user(self):
# The ids are explicit, not the requester — a shared "my accounts" link
# resolves to the same accounts no matter which user opens it.
- target = create_account(team_id=self.team.id, name="Target", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- create_account(team_id=self.team.id, name="Other", _properties={"csm": {"id": 8, "email": "[email protected]"}})
+ holder = self._create_user("[email protected]")
+ other_holder = self._create_user("[email protected]")
+ target = create_account(team_id=self.team.id, name="Target")
+ self._assign(target, holder)
+ other = create_account(team_id=self.team.id, name="Other")
+ self._assign(other, other_holder)
other_user = self._create_user("[email protected]")
- as_user = self._ids(user=self.user, assignedToUserIds=[7])
- as_other_user = self._ids(user=other_user, assignedToUserIds=[7])
+ as_user = self._ids(user=self.user, assignedToUserIds=[holder.id])
+ as_other_user = self._ids(user=other_user, assignedToUserIds=[holder.id])
self.assertEqual(as_user, [str(target.id)])
self.assertEqual(as_user, as_other_user)
def test_assigned_to_user_unknown_id_matches_nothing(self):
- create_account(team_id=self.team.id, name="Has CSM", _properties={"csm": {"id": 7, "email": "[email protected]"}})
+ account = create_account(team_id=self.team.id, name="Has CSM")
+ self._assign(account, self._create_user("[email protected]"))
self.assertEqual(self._ids(assignedToUserIds=[999999]), [])
def test_assigned_to_user_empty_ids_is_a_noop(self):
- a = create_account(team_id=self.team.id, name="Has CSM", _properties={"csm": {"id": 7, "email": "[email protected]"}})
+ a = create_account(team_id=self.team.id, name="Has CSM")
+ self._assign(a, self._create_user("[email protected]"))
self.assertEqual(self._ids(assignedToUserIds=[]), [str(a.id)])
def test_assigned_to_user_combines_with_search(self):
- match = create_account(team_id=self.team.id, name="Acme", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- create_account(team_id=self.team.id, name="Globex", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- self.assertEqual(self._ids(assignedToUserIds=[7], search="acme"), [str(match.id)])
+ holder = self._create_user("[email protected]")
+ match = create_account(team_id=self.team.id, name="Acme")
+ self._assign(match, holder)
+ globex = create_account(team_id=self.team.id, name="Globex")
+ self._assign(globex, holder)
+ self.assertEqual(self._ids(assignedToUserIds=[holder.id], search="acme"), [str(match.id)])
def test_assigned_to_user_respects_team_isolation(self):
+ holder = self._create_user("[email protected]")
other_team = Team.objects.create(organization=self.organization)
- create_account(team_id=other_team.id, name="Theirs", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- mine = create_account(team_id=self.team.id, name="Mine", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- self.assertEqual(self._ids(assignedToUserIds=[7]), [str(mine.id)])
+ theirs = create_account(team_id=other_team.id, name="Theirs")
+ their_definition = AccountRelationshipDefinition.objects.for_team(other_team.id).create(
+ team_id=other_team.id, name="CSM"
+ )
+ relationships_logic.assign(
+ team_id=other_team.id, account=theirs, definition=their_definition, user=holder, created_by=holder
+ )
+ mine = create_account(team_id=self.team.id, name="Mine")
+ self._assign(mine, holder)
+ self.assertEqual(self._ids(assignedToUserIds=[holder.id]), [str(mine.id)])
def test_assigned_to_user_metrics_mode_counts_only_matching_accounts(self):
- create_account(team_id=self.team.id, name="Mine", _properties={"csm": {"id": 7, "email": "[email protected]"}})
- create_account(team_id=self.team.id, name="Theirs", _properties={"csm": {"id": 8, "email": "[email protected]"}})
+ holder = self._create_user("[email protected]")
+ other_holder = self._create_user("[email protected]")
+ mine = create_account(team_id=self.team.id, name="Mine")
+ self._assign(mine, holder)
+ theirs = create_account(team_id=self.team.id, name="Theirs")
+ self._assign(theirs, other_holder)
runner = AccountsQueryRunner(
- query=AccountsQuery(metrics=["count()"], select=[], assignedToUserIds=[7]),
+ query=AccountsQuery(metrics=["count()"], select=[], assignedToUserIds=[holder.id]),
team=self.team,
user=self.user,
)
@@ -336,67 +360,6 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):
# `zero` has no notebook rows, so the aggregate is NULL and lands at the end.
self.assertEqual(str(response.results[-1][id_idx]), str(zero.id))
- @parameterized.expand(
- [
- ("csm", "csm"),
- ("account_executive", "account_executive"),
- ]
- )
- def test_ordering_by_role_email_asc(self, _name, role_key):
- zed = create_account(
- team_id=self.team.id, name="Zed", _properties={role_key: {"id": 1, "email": "[email protected]"}}
- )
- adam = create_account(
- team_id=self.team.id, name="Adam", _properties={role_key: {"id": 2, "email": "[email protected]"}}
- )
- molly = create_account(
- team_id=self.team.id, name="Molly", _properties={role_key: {"id": 3, "email": "[email protected]"}}
- )
-
- runner = AccountsQueryRunner(
- query=AccountsQuery(
- select=["id", role_key],
- orderBy=[f"tupleElement({role_key}, 2)"],
- ),
- team=self.team,
- user=self.user,
- )
- response = runner.calculate()
- id_idx = runner.columns.index("id")
- self.assertEqual(
- [str(row[id_idx]) for row in response.results],
- [str(adam.id), str(molly.id), str(zed.id)],
- )
-
- @parameterized.expand(
- [
- ("csm", "csm"),
- ("account_executive", "account_executive"),
- ]
- )
- def test_ordering_by_role_email_desc(self, _name, role_key):
- zed = create_account(
- team_id=self.team.id, name="Zed", _properties={role_key: {"id": 1, "email": "[email protected]"}}
- )
- adam = create_account(
- team_id=self.team.id, name="Adam", _properties={role_key: {"id": 2, "email": "[email protected]"}}
- )
-
- runner = AccountsQueryRunner(
- query=AccountsQuery(
- select=["id", role_key],
- orderBy=[f"tupleElement({role_key}, 2) DESC"],
- ),
- team=self.team,
- user=self.user,
- )
- response = runner.calculate()
- id_idx = runner.columns.index("id")
- self.assertEqual(
- [str(row[id_idx]) for row in response.results],
- [str(zed.id), str(adam.id)],
- )
-
def test_pagination_limit_and_offset(self):
ids = [str(create_account(team_id=self.team.id, name=f"Account {i:02d}").id) for i in range(5)]
expected_reverse = list(reversed(ids))
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index f12b031eee5c..081173065c0c 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -7591,8 +7591,9 @@ export interface AccountsQueryResponseApi {
}
export interface AccountsQueryApi {
+ /** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean | null
- /** Match accounts where any of these user ids is the CSM or the account executive (OR over both roles). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
+ /** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: number[] | null
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
filterExpression?: string | null
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 122d22ee4fb2..7f8167379e8c 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -6945,8 +6945,9 @@ export interface AccountsQueryResponseApi {
}
export interface AccountsQueryApi {
+ /** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean | null
- /** Match accounts where any of these user ids is the CSM or the account executive (OR over both roles). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
+ /** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: number[] | null
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
filterExpression?: string | null
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 66e6fa51cb25..be430f5afbec 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -622,8 +622,9 @@ export namespace Schemas {
}
export interface AccountsQuery {
+ /** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean | null;
- /** Match accounts where any of these user ids is the CSM or the account executive (OR over both roles). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
+ /** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: number[] | null;
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
filterExpression?: string | null;