Properties, Tags & Segments

Model custom fields, labels, and dynamic audiences. This guide follows version 3.1.7 (03acdf712c).

For bulk changes, see Import & Export.

Properties

backend/core-api/src/modules/properties/:

  • graphql/schemas/{field,group,property,index}.ts, db/definitions/{field,group,common}.ts, db/models/{Field,Group}.ts, trpc/{field,group,index}.ts.
  • A field defines name, code, groupId, contentType, type, order, logics, validations, and options[]. Groups organize fields per content type.
  • Shared filter and merge helpers live in backend/erxes-api-shared/src/core-modules/properties/.

Add fields per content type (contact, product, deal, ticket) rather than overloading text fields. Validate inputs at the API boundary because custom-field data is stored as structured JSON.

Tags

backend/core-api/src/modules/tags/ (schemas.ts, queries.ts, mutations.ts, db/models/Tags.ts, trpc/tag.ts, taggable.ts):

  • A tag has name (unique), colorCode, parentId/relatedIds, isGroup, type (content type), and objectCount.
  • taggable.ts mixes tagging into any entity. Use tags for operator-driven labels, not for access control.

Segments

backend/core-api/src/modules/segments/ (schemas/index.ts, db/definitions/{segments,segmentNodes,segmentHistory}.ts, trpc/segments.ts):

  • A segment has contentType, root node tree, dependsOn, fingerprint, visibility (private|organization), status (draft|building|active|failed|cancelled), and membersCount.
  • Evaluation lives in backend/erxes-api-shared/src/core-modules/segments/ (evaluate, mongoFilter, memberQuery, membership).

Segments are computed, not manual lists. If members look stale, check the segment status and the logs-service segmentWorker before editing filters.

Source references

Was this helpful?