Skip to content

[P1] formula: cross-object formula not supported — can't derive ticket.priority from customer.tier #1309

@xuyushun441-sys

Description

@xuyushun441-sys

来源:docs/PLATFORM_GAPS_FROM_TEMPLATES.md 第 36 条(P1)。

现象

formula 字段不能跨对象引用。在 ticket 上想用 customer.tier 来推导优先级,写不出来:

// 想要的:
{ name: 'derived_priority', type: 'formula', expr: `customer.tier == 'enterprise' ? 'urgent' : 'normal'` }
// 实际:formula 上下文里只能拿到本对象字段

只能写 flow 在 customer 变化时回填 ticket 的字段 —— flow 模拟派生字段:

  • 不实时
  • 多链路同步易漂移
  • 关联深一层就崩
  • 列表渲染时 N+1

复现

helpdesk 模板:

  • 想按 customer.tier 自动设 SLA → 不能 derive
  • 想按 team.timezone 算业务时间 → 不能 derive

procurement

  • 想按 vendor.compliance_score 决定审批阈值 → 不能 derive

当前 workaround

  • 字段冗余 + flow 同步(前述问题)
  • view 计算列(仅展示)

建议范围

M1:formula 支持 lookup 字段一跳

  • customer.tier / team.name / assignee.role 等单跳支持
  • 编译时检查、运行时缓存
  • 列表批量预取避免 N+1

M2:多跳(链式)

  • customer.organization.industry 谨慎开放
  • 默认 2 跳上限

M3:依赖追踪 + 失效

  • 关联对象变更时增量重算
  • 索引 / 物化策略可配置

M4:rollup 字段(关联:子记录聚合)

  • 与跨对象 formula 是双胞胎:children.count() / .sum(amount)

验收

关联

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:p1High: required for production / M2

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions