CRM · Segment builder with automatic tag actions
Two-tab editor for a segment: general data (name, category, account types) plus a live filter builder that previews the matching customers, with optional rules that automatically add or remove user tags as people enter or leave the segment.
| Area | CRM |
| Routes | crm.segments.new · crm.segments.edit |
| Centre modules | ai · crm · employees_segments |
| Staff levels | root · admin · manager · crmmanager |
| Models | building · segment · user · user-account-type · user-type · usertype-linked-segment |
| UI label | crm.new-segment |
| Coverage | 3 use cases · 1 happy · 6 failure |
Known issues (1)
How it works
The preview table reuses the customer columns, and the same AI filter and export affordances as the customer list are available here. addNewAutomaticActionType / removeAutomaticAction manage usertypeLinkedSegments fragments, each needing both a usertype and a dynamic flag — the model validates this with a single combined message. isLifeCycleSegment flags segments driven by lifecycle rules. When the centre has employee segments, at least one account type is mandatory (userAccountTypes.length.minimum 1). New user tags can be created inline (addNewUserType), which validates the tag model separately into userTypeErrors.
Use cases
Why someone opens this (3)
- Defining ‘families with children under 12 who shopped in the last 90 days’ once and reusing it everywhere.
- Auto-tagging customers as VIP when they enter a segment and untagging them when they leave.
- Restricting a segment to employee account types in centres with employee segmentation.
Path map
flowchart LR F(["Segment builder with automatic tag actions"]):::feat F --> H1["Segment created with an automatic tag rule"]:::ok F -.-> X1["Name missing"]:::bad F -.-> X2["Account types missing"]:::bad F -.-> X3["Incomplete automatic action"]:::bad F -.-> X4["Inline user-tag creation invalid"]:::bad F -.-> X5["Filters not applicable"]:::bad F -.-> X6["Save rejected"]:::bad classDef feat fill:#157068,stroke:#157068,color:#ffffff,font-weight:bold classDef ok fill:#e3f1ea,stroke:#0d6b42,color:#0d4a2e classDef bad fill:#f7e6e2,stroke:#9a2d1c,color:#6e1f13
Happy paths
Segment created with an automatic tag rule
- User names the segment, picks a category and (if required) account types.
- Filters are assembled in the builder; the preview refreshes with matching customers.
- An automatic action is added: tag X, dynamic on.
submitvalidates the segment and the linked-segment fragments and saves it.
Failure paths
Name missing
Cause —
segmentNameblank.What happens — Presence rule fails;
_scrollTop()scrolls the error into view.
Account types missing
Cause — Employee-segments centre with no account type selected.
What happens — Minimum-length rule fails with
required+user.account-type.
Incomplete automatic action
Cause — A
usertypeLinkedSegmentsrow lacksusertypeordynamic.What happens —
error.user.automatic-action-type(‘Remember that you have to fill in all the fields’) — one message for the whole collection, so the operator is not told which row is wrong.
Inline user-tag creation invalid
Cause — The new tag fails its own validations.
What happens —
userTypeErrorsis populated viaparseErrorsand shown on the inline form.
Filters not applicable
Cause —
isDisableApplyFiltersis true (incomplete filter rows).What happens — Apply is disabled; the preview is not refreshed.
Save rejected
Cause — API error.
What happens — A bare
.catch(() => {})in the submit chain hides the reason.
QA checklist
Tick these off while regression-testing this feature. The boxes are plain Markdown, so progress is visible in git diffs.
- ✅ Segment created with an automatic tag rule
- ⛔ Name missing
- ⛔ Account types missing
- ⛔ Incomplete automatic action
- ⛔ Inline user-tag creation invalid
- ⛔ Filters not applicable
- ⛔ Save rejected
Implementation
app/controllers/crm/segments/new.jsapp/routes/crm/segments/new.jsapp/models/segment.jsapp/models/usertype-linked-segment.jsapp/components/segment-filters.jsapp/enums/automatic-action-types.js
Translation keys (8)
Key English crm.new-segmentNew segment general_dataGeneral data segment.segment-categorySegment category segment.account-typesAccount type segment.automatic-tagsAutomatic tags error.user.automatic-action-typeRemember that you have to fill in all the fields segment.app-notificationsApp notifications segment.email-notificationsEmail notifications
Related
- Same area — Customer list & filtering · Customer create & edit · Customer deletion with unsubscribe notice · Customer CSV export with column picker · Customer CSV import · Children CSV import · AI natural-language customer filter · Save current filters as a segment · Segment list, refresh & export · Segment categories · User tags (user types) · Customer receipts tab & ticket-stamp generation · Customer loyalty — raffle tickets · Customer loyalty — cards & stamps · Customer loyalty — rewards · Customer loyalty — coupon exchanges · Customer children (dependants) · Receipt verification queue · Store list, filters & exports · Store create & edit · Store CSV import · Store labels (store types) · Customer action log (dormant)
- Shares data with — Staff member editor (levels, scope, API token) · Activity editor (loyalty mechanics, rules & targeting) · Email campaign list, duplication & stop · Email campaign builder (wizard, A-B test, scheduling) · Proposal editor (content, coupon, push, AI images) · Push notification editor (scheduling, geofencing, deep links) · Filter & segment builder component · Data-quality dashboard
- Behind the same module — Proposal editor (content, coupon, push, AI images) · Staff member editor (levels, scope, API token) · AI natural-language customer filter · CandelarIA smart assistant
Generated from doc/feature-inventory.json · id crm-segment-builder · commit 276788ca6