form: stop asking for what the workflow computes
`documents_status` was a dropdown — not yet / partially / all uploaded — put to the person who had just attached the files. It asked them to tell the system what it could see for itself. Not cosmetic. That field gates the AND-join that wakes Engage after an upload (55). Left on its default, the lead sits in Document Pending with all three documents attached and nothing happening, and it reads as the AI having stalled rather than as a form field nobody filled. It is derived in the trigger now (75), from the files themselves, after the commit and before the join reads it — server-side, because a value computed only in the browser would be right on screen and absent to the API. `documents_notes` goes with it: the same script writes what is still missing, and a person overwriting that would be arguing with the file list. So both are declared derived and no form asks for them, with or without a lead behind it. Matched on the base id, so every per-activity suffix is covered rather than the two that happen to exist today.
This commit is contained in:
parent
fc5eace791
commit
8b6a387cf6
@ -263,6 +263,25 @@ export const LINE_FIELDS = {
|
|||||||
// leads carry one too — a company-owned vehicle has an owner with a name.
|
// leads carry one too — a company-owned vehicle has an owner with a name.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields the workflow computes for itself, which a form must therefore not ask
|
||||||
|
* for. Matched on the base id, so every per-activity suffix is covered.
|
||||||
|
*
|
||||||
|
* `documents_status` is the one that matters. It gates the AND-join that wakes
|
||||||
|
* Engage after an upload (55), and it was rendered as a dropdown — asking the
|
||||||
|
* person who had just attached three files to tell the system what it could
|
||||||
|
* see. Left unset, the lead sits in Document Pending with everything attached
|
||||||
|
* and nothing happening, and it reads as the AI having stalled. It is derived
|
||||||
|
* in the trigger now (75), from the files themselves.
|
||||||
|
*
|
||||||
|
* `documents_notes` goes with it: the same script writes what is still missing,
|
||||||
|
* and a person overwriting that would be arguing with the file list.
|
||||||
|
*/
|
||||||
|
export const DERIVED_FIELDS = new Set([
|
||||||
|
'documents_status',
|
||||||
|
'documents_notes',
|
||||||
|
])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form field ids carry a per-form suffix — `doc_rc` arrives as `doc_rc_2`, `pan`
|
* Form field ids carry a per-form suffix — `doc_rc` arrives as `doc_rc_2`, `pan`
|
||||||
* as `pan_3` — so a field is matched on the id with that suffix removed. No
|
* as `pan_3` — so a field is matched on the id with that suffix removed. No
|
||||||
@ -305,6 +324,9 @@ export function leadLine(lead) {
|
|||||||
* line to filter on.
|
* line to filter on.
|
||||||
*/
|
*/
|
||||||
export function fieldApplies(fieldId, lead) {
|
export function fieldApplies(fieldId, lead) {
|
||||||
|
// Computed by the workflow — never asked for, on any form, whether or not
|
||||||
|
// there is a lead behind it.
|
||||||
|
if (DERIVED_FIELDS.has(baseFieldId(fieldId))) return false
|
||||||
if (!lead) return true
|
if (!lead) return true
|
||||||
const on = leadLine(lead)
|
const on = leadLine(lead)
|
||||||
if (!on) return true
|
if (!on) return true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user