Skip to content

Kanban: dropping a card into a stage that makes fields required (requiredWhen) should prompt for them, not just reject #4254

Description

@yinlianghui

Scenario (HotCRM, console pinned in @objectstack/console 17.0.0-rc.5)

HotCRM's opportunity pipeline kanban groups by stage. The object declares:

win_reason: Field.select({
  requiredWhen: P`has(record.stage) && record.stage == "closed_won"`,
  ...
})

Dragging a card into the Closed Won column PATCHes {stage: 'closed_won'} alone. The engine correctly refuses (ValidationError: Win Reason不能为空), so the move can never succeed from the board — the only way to close a deal is to abandon the board and open the record form.

Observed

Expected

On a rejected drop — or better, before PATCHing, by evaluating the target column's requiredWhen fields against the record — open a small dialog collecting the now-required fields (here: Win Reason), then submit stage + collected fields together. This is the same contract the record form already honours; the board should not be a dead end for transitions the metadata explicitly supports.

Repro

  1. Boot HotCRM main (333259a4), open Opportunities → 销售流水线 (pipeline_kanban).
  2. Drag any open deal into 成交 (Closed Won).
  3. Server log: Update operation failed … Win Reason不能为空; board shows no prompt; refresh reverts the card.

Related: #4138 (rollback on rejected drag), objectstack#7525 (statusCode-carrying refusals leak as 500).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions