Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/2060-item-4-claim-web-case.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hotcrm': patch
---

A service agent can now pick up a case that came in through the web support form. Such a case has no **Account** (the public form does not ask for one), and the case form marked **Account** as required, so moving the case to **In Progress** to claim it stopped at *"Please check the highlighted fields: Account"* and nothing was saved. The form no longer requires **Account**: the claim saves and the case becomes the agent's, as the Cases guide describes. **Account** stays on the form. A case raised in the console may now also be saved without one; its SLA target is the one for an **SMB** customer, the same as a web case's, and escalating it opens no account follow-up task.
9 changes: 8 additions & 1 deletion src/service/views/case.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,14 @@ export const CaseViews = defineView({
fields: [
'case_number',
{ field: 'subject', required: true, span: 'full' },
{ field: 'crm_account', required: true },
// Offered, ⛔ not `required` (#2060 item 4): `crm_case.crm_account`
// is optional on the object and a web-to-case submission carries
// none. This form is also the one an agent claims such a case
// through (a move to In Progress), so `required` here refused that
// save client-side ("Please check the highlighted fields: Account")
// while the server took it. A case with no account takes the `smb`
// SLA column, and the escalation task and resolution bump skip it.
'crm_account',
'crm_contact',
{ field: 'status', required: true },
'priority',
Expand Down
13 changes: 13 additions & 0 deletions test/case-create-form-narrowing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,19 @@ describe('crm_case create form — removal direction', () => {
expect(new Set(authorable)).toEqual(CREATOR_AUTHORABLE);
});

it('offers `crm_account` without requiring it — a web case carries none (#2060 item 4)', () => {
// This is the edit form too, and an agent claims a web case through it (a
// move to In Progress). Measured on 18.0.0-next.1: with `required` here the
// console refused that save ("Please check the highlighted fields: Account")
// with nothing sent, while the server took the same PATCH.
const entries: unknown[] = ((CaseViews as AnyRec).form?.sections ?? []).flatMap(
(s: AnyRec) => s.fields ?? [],
);
const account = entries.find((f) => (typeof f === 'string' ? f : (f as AnyRec)?.field) === 'crm_account');
expect(account, 'crm_account left the case form — this pin would judge nothing').toBeDefined();
expect((account as AnyRec)?.required === true, 'the case form demands an account again').toBe(false);
});

it('the public web-to-case form stays narrower still', () => {
const wtc = (CaseViews as AnyRec).formViews?.web_to_case;
const fields = (wtc?.sections ?? []).flatMap(fieldNamesOf);
Expand Down
Loading