Skip to content

widget-form-relations

App: Backend
Source: web/projects/backend/src/widgets/widget-form-relations

Purpose

Maps forms to module objects (Parts, Documents, NCRs, etc.) so dashboards know which forms to require. Also defines whether a form is required and how validation scope works (per user vs. per object/global).

Data Flow

  1. Loads all active forms (status=2) via FormControllerService.find with fields: { id, name } to populate dropdowns.
  2. Reads ModuleState.module and the dashboard state to determine module_id and object_id.
  3. Fetches existing relations with FormRelationControllerService.find({ include: ['form'], where: { module_id, object_id } }) and binds them to a table.

Dialog Behaviour

FormRelationDialogComponent handles both create and edit modes:

  • Fields: form_id, required, validation_scope (per_user, per_object, global).
  • Persisted through create, updateById, or deleteById in the SDK.
  • After dialog close, the widget refreshes and notifies the user via NOTYF toast.

Extension Tips

  • To show additional filters (e.g., by form category), extend the forms query to include category and render grouped dropdown sections.
  • Validation scope strings should stay in sync with the Front widget; add custom scopes there before exposing them here.

Syneo/Barcoding Documentation