2026-03-06
Prevent Deleting Fields Referenced in Formulas / Validation Rules (Dynaforms)
- Feature Enhancement: Added a deletion guard that prevents users from deleting a field on the canvas if its
jsonKeyis referenced anywhere in the form — in formulas, formula libraries, rule conditions, or validation rules. - New method
isFieldReferencedInFormulas(jsonKey)added toDynaformService. It reuses the existingtraverseCanvasElementsutility (no new traversal loop) with a visitor that checks all 4 reference types in a single pass:el.formula— legacy formula on formula-type fieldsel.formulaLibrary[].formula— formula library entriesel.rules[].condition— rule condition keys (uses direct equality via a recursivecheckConditionTreehelper, since conditions store keys as standalone values)el.validationRules[].formula— validation rules on any field type (uses word-boundary regex since keys are embedded in expression strings)
- Returns an array of referencing element labels (empty = safe to delete).
- Guard added in
CenterPanelComponent.deleteElement(): CallsisFieldReferencedInFormulasbefore proceeding. If the field is referenced, shows an error toast listing the referencing elements and blocks the deletion. Follows the same pattern as the existingdeleteFormulaFromLibrary/isFormulaInUseguard.