Ticket lifecycle and agent workspace
The ticket lifecycle turns a customer request into a shared work item that agents can find, update, route, and resolve. The HD Ticket record is the source for the ticket's identity, requester, status, priority, team, service targets, and links to its conversation and activity history. The agent workspace joins that record with ticket APIs so an agent can act on the ticket without leaving its context.
This page focuses on the ticket record and agent work surface. See Ticket management for the wider helpdesk model and Ticket communications for the message flow around a ticket.
Ticket creation
Ticket creation accepts a subject, a detailed description, optional template fields, and attachments. The ticket API adds the current session as the requester, records the source context, and inserts the HD Ticket record. Ticket defaults then supply the ticket type, priority, status, contact, customer, and service agreement when the available settings and links allow it. The first description becomes the first linked communication, so the new ticket already has a conversation for the agent workspace.
Creation also checks who a non-agent can represent. A portal user can create or change a ticket only for the contact owned by that session, and a selected customer must be linked to that contact. Agents and system channels have broader access because they act for customers or receive requests from external sources.
The creation page serves both the customer portal and the agent desk. It loads the selected ticket template, shows only fields allowed for the current audience, validates required values, and routes to the new ticket after a successful insert. A subject can also be supplied by the command palette as a starting value.
References: helpdesk/…/api.py• L27-35 helpdesk/…/hd_ticket.py• L69-105 helpdesk/…/hd_ticket.py• L265-350 helpdesk/…/hd_ticket.py• L169-188 desk/…/TicketNew.vue• L14-130 desk/…/TicketNew.vue• L188-287
Ticket retrieval
Ticket retrieval gives the list and detail views the same permission-checked record. The list is driven by HD Ticket views and can show status, priority, assignment, team, requester context, and service targets. It supports saved, private, and public views, row navigation, export, and agent-only bulk actions. Status labels use the agent or customer wording for the active audience, while SLA columns show whether response or resolution work is due, paused, fulfilled, or failed.
A row opens either the customer ticket view or the agent ticket view. The detail API returns the ticket with its contact, template fields, communications, comments, change history, views, tags, and related call records. These linked resources let the workspace present one ticket rather than separate record and activity screens.
Visibility follows the user's relationship to the ticket. Customers see tickets they raised or own and tickets for customers they manage. Agents see tickets allowed by their team access or assignment rules. These checks apply both to the list query and to an individual ticket read, so an unreadable ticket is not treated as a partial detail record.
References: helpdesk/…/api.py• L38-127 helpdesk/…/api.py• L148-159 helpdesk/…/hd_ticket.py• L1313-1412 desk/…/Tickets.vue• L31-41 desk/…/Tickets.vue• L171-248 desk/…/Tickets.vue• L372-457 desk/…/TicketAgent.vue• L20-46 helpdesk/…/hd_ticket.json• L75-120
Ticket editing
Editing changes the HD Ticket record through document updates. The agent workspace exposes the subject, core ticket fields, custom fields, team, and tags in the header or details area. A successful field change refreshes related assignment or activity data when needed, while the ticket model records field changes as ticket history.
The ticket keeps operational fields separate from derived service data. Agents can change fields such as priority, type, customer, and team when they have access. The system derives values such as status category, response and resolution targets, response timestamps, resolution timestamps, and SLA state from the saved ticket and its related settings. Non-agent portal users cannot change a closed or rated ticket and cannot attribute a ticket to another contact.
The mobile details surface applies the ticket's field metadata and customizations to decide which extra fields are visible, required, or read-only. It also groups available custom actions into one compact action menu, so the same ticket actions remain available when the workspace has less screen space. The team picker appears when the ticket customizations expose the team field, and field changes use the shared ticket update path.
The agent desk can also expose controlled ticket actions such as merge and split. A merge target must be a different, active, unmerged ticket with matching requester and customer context when those links exist. The merge is irreversible and preserves the work history by moving or linking related activity rather than treating the new record as an unrelated request.
References: desk/…/TicketDetailsTab.vue• L28-99 desk/…/TicketDetailsTab.vue• L341-369 desk/…/MobileTicketAgent.vue• L101-149 desk/…/MobileTicketAgent.vue• L326-377 desk/…/MobileTicketAgent.vue• L379-426 desk/…/MobileTicketAgent.vue• L498-509 desk/…/MobileTicketAgent.vue• L512-551 desk/…/TicketMergeModal.vue• L1-10 desk/…/TicketMergeModal.vue• L128-173 desk/…/TicketMergeModal.vue• L178-210 helpdesk/…/hd_ticket.py• L75-105 helpdesk/…/hd_ticket.py• L410-418 helpdesk/…/hd_ticket.py• L947-1015 helpdesk/…/ticket.py• L288-505
Ticket status and priority
Status describes the ticket's current work state. Each enabled HD Ticket Status has an agent label, an optional customer label, an order, a color, and a category. The category groups statuses into Open, Paused, and Resolved; this category controls whether SLA time runs, pauses, or stops. Agents change status from the desktop header or mobile status menu, and the selected status is saved to the ticket.
Priority describes the urgency level used by the workspace and list views. A priority record has a name, a level, a description, and an enabled state. New tickets take priority from their ticket type or the default setting. Agents can then change it in the details area. Status and priority changes appear in ticket history, which gives later users the reason and sequence of key lifecycle changes.
When a ticket enters the resolved category, the system records its resolution time. A later customer communication reopens it with the configured reopen status when an agent has already replied; otherwise it uses the default open status. An agent reply can also trigger the configured automatic status update. If feedback is mandatory, a non-agent transition to the resolved category requires feedback after an agent reply.
The mobile workspace presents enabled agent status labels in its status menu and uses the status color from the shared status records. This keeps the mobile control aligned with the status shown in the ticket list and the desktop workspace.
References: helpdesk/…/hd_ticket_status.json• L21-75 desk/…/ticketStatus.ts• L5-36 desk/…/TicketHeader.vue• L45-67 desk/…/MobileTicketAgent.vue• L498-510 helpdesk/…/hd_ticket.py• L351-375 helpdesk/…/hd_ticket.py• L393-408 helpdesk/…/hd_ticket.py• L1053-1095 helpdesk/…/hd_ticket_priority.json• L13-33 desk/…/ticketPriority.ts• L5-30
Assignment-facing actions
Assignment connects a ticket to one or more users and keeps routing visible in the ticket workspace. The agent picker loads available assignees, supports search and multi-select, and shows current availability when agent data is available. Closing the picker applies additions and removals, records the assignment action, and refreshes the assignee and activity views. Assigning a user can also create a notification for that user.
The ticket model also reconciles team and assignment state. When an open ticket changes team, an assigned agent outside the new team is cleared if the team's active assignment rule has users. This keeps team routing and direct assignment from silently disagreeing.
The list view extends these actions across selected tickets. Agents can bulk assign, bulk edit, or bulk reply. Bulk reply checks write access for every selected ticket before it writes, keeps attachments linked to each ticket, and records failures without stopping the other replies. Agents can also export the selected tickets or the full result set while keeping the active view's filters and sort order.
References: desk/…/AssignTo.vue• L29-67 desk/…/AssignTo.vue• L518-610 helpdesk/…/hd_ticket.py• L423-476 helpdesk/…/hd_ticket.py• L478-483 helpdesk/…/ticket.py• L7-63 helpdesk/…/ticket.py• L65-79 desk/…/Tickets.vue• L122-169 desk/…/Tickets.vue• L311-352 helpdesk/…/test_hd_ticket.py• L144-181
Agent workspace
The agent workspace presents one ticket as a working surface. The header provides the ticket path, active viewers, custom actions, status control, and protected actions such as merge or administrator-only deletion. The main area shows the ticket activity and communication tools. The sidebar shows the requester, SLA state, assignment, core fields, custom fields, tags, feedback, and recent tickets. The desktop route waits for the activity feed and ticket record before showing the workspace, so the first view does not mix an incomplete record with its activity.
The activity area combines communications, comments, change history, views, and calls into a time-ordered activity stream. Separate tabs filter that stream by type, while the communication area lets an agent reply to the requester. Communication cards show safe rendered message content and linked attachments. Analytics is available as a separate tab, and calls appear when telephony is enabled. The call actions let an agent start a call or log a completed call against the ticket. The desktop workspace receives live ticket and comment events, so another user's change can refresh the open record and its activity data.
The mobile workspace keeps the same ticket actions in a smaller surface. It places status in the top header, puts team and assignment controls beside it, and groups custom actions in one compact menu. It exposes details, activity, email, comments, and optional calls as tabs. The details tab includes the contact, source, SLA context, feedback, and editable ticket fields. The communication area remains available below the tabs for replies, and a successful communication refreshes both the ticket and its timeline. Mobile refreshes cached ticket data when the page opens rather than relying on the desktop live-view flow.
The detail resource caches each ticket by ID and keeps its ticket document beside its assignees, contact, related tickets, activities, calls, comments, and on-demand analytics. A revisited ticket can display cached data first and then refresh in the background. Opening a ticket records the visit, marks it seen, and clears its ticket notifications.
References: desk/…/TicketAgent.vue• L1-47 desk/…/TicketAgent.vue• L101-239 desk/…/MobileTicketAgent.vue• L1-221 desk/…/MobileTicketAgent.vue• L321-459 desk/…/MobileTicketAgent.vue• L488-564 desk/…/TicketCommunication.vue• L1-25 desk/…/TicketCommunication.vue• L56-68 desk/…/TicketHeader.vue• L1-75 desk/…/TicketDetailsTab.vue• L1-141 desk/…/TicketActivityPanel.vue• L1-49 desk/…/TicketActivityPanel.vue• L78-109 desk/…/TicketCallActions.vue• L17-50 desk/…/useTicket.ts• L24-96
Ticket analytics
Per-ticket analytics turns the ticket record and its activity history into a view of service progress. The agent workspace can show creation, first response, hold, and resolution milestones with response gaps, pause time, conversation totals, involved agents, and routing churn. When a ticket has an SLA, durations use its working calendar; without one, the view uses elapsed time.
Customer and contact views add a wider service picture around the ticket. Agents can review feedback, failed SLAs, average first response time, and average resolution time for a selected period. Agent Managers can also compare agent results for a team or date range.
References: helpdesk/…/ticket_analytics.py• L21-64 helpdesk/…/ticket_analytics.py• L67-84 helpdesk/…/ticket_analytics.py• L192-246 helpdesk/…/ticket_stats.py• L54-109 helpdesk/…/ticket_stats.py• L218-242 helpdesk/…/ticket_stats.py• L245-324 desk/…/TicketAnalyticsTab.vue• L1-51 desk/…/useTicket.ts• L77-96 desk/…/TicketStats.vue• L1-105
Ticket navigation
Navigation keeps an agent inside the active ticket view while moving through its result set. The navigation API reads the selected view's filters and sort order, removes the current ticket, and returns a bounded list of ticket IDs. The workspace keeps the active view in the route so the agent can move to the next or previous ticket without losing the view context.
The agent can move to the next or previous ticket with the Shift+> and Shift+< shortcuts. When the route changes, the workspace stops live viewing for the old ticket, starts it for the new one, and revalidates cached data. A ticket with no readable record shows an access-or-not-found state instead of a partial workspace.
This sequence shows how a view selection becomes a navigable ticket workspace.
flowchart LR
V[Active ticket view] --> F[View filters and sort order]
F --> N[Navigation ticket IDs]
N --> R[Agent ticket route]
R --> W[Ticket workspace]
W --> U[Next or previous ticket]
U --> R
References: helpdesk/…/api.py• L523-607 desk/…/useTicketNavigation.ts• L8-82 desk/…/TicketAgent.vue• L165-179 desk/…/TicketAgent.vue• L203-229 desk/…/Tickets.vue• L31-41
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the
HD Ticketfield names aligned across the doctype, ticket detail API, custom field metadata, desktop sidebar, and mobile details path. - Keep the agent and customer status labels aligned with status categories. The list, header, mobile menu, SLA view, and customer portal each resolve labels through the status record.
- Keep list-view filters, sort order, export conditions, and
@meresolution aligned so exports describe the same ticket set that the agent sees. - Preserve the link between communications, comments, attachments, calls, and the ticket when changing reply, split, merge, call-log, or bulk-reply flows.
- Keep communication rendering restricted to the supported safe content and attachment shape when changing activity cards or message APIs.
- Keep assignment writes, assignment activity, notifications, and team restriction checks consistent when changing routing behavior.
- Keep navigation filters and route view state aligned so next and previous actions stay inside the agent's selected view.
- Keep desktop live updates and mobile cache revalidation consistent with the ticket resource so one workspace does not show stale state after another user changes the ticket.
- Keep desktop feed readiness and mobile tab data aligned with the shared ticket resource so each surface shows a complete record before agent actions are available.
- Keep analytics refresh triggers aligned with status and priority changes so SLA milestones and timing metrics do not describe an earlier ticket state.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A user reads a ticket outside the permission query or document permission rules | The list and detail views can disagree about whether the ticket exists | Apply both the HD Ticket read permission and the role or team visibility rules |
| A non-agent sets a contact or customer that is not owned or linked to the session | The ticket can be attributed to a person or customer outside the user's scope | Validate the session contact and the contact-to-customer link before saving |
| An agent changes the team without checking the current assignee | An agent outside the new team can remain assigned to an open ticket | Reconcile assignments after team changes when an active assignment rule has users |
| A replied ticket is resolved without required feedback by a non-agent flow | The lifecycle loses the required customer outcome | Reject the resolved transition when feedback is mandatory and no feedback exists |
| A customer reply reaches a merged ticket | The reply can remain on a closed source ticket instead of the active work item | Resolve a safe merge target and redirect the communication; handle an invalid merge chain on the source |
| A merge target is closed, already merged, or has a different requester or customer | The source and target can combine unrelated or inactive work | Restrict target selection and validate the merge conditions before the irreversible action |
| A ticket is reopened without resolving its configured status | Customer activity does not return the ticket to the intended work state | Use the SLA or helpdesk setting for the reopen status and fall back to the default open status |
| A bulk reply writes one ticket before finding a permission failure on another | The batch can leave a partial set of tickets updated | Check write access for every selected ticket before sending any reply |
| The desktop route changes without stopping the old live view | Updates for the old ticket can remain attached to the new workspace | Stop viewing the old ticket, start viewing the new one, and revalidate its cached data |
| Communication content is rendered without the allowed content and attachment rules | A message can display unsafe markup or fail to show its linked files correctly | Sanitize rendered content and pass only the supported attachment fields to the communication card |
| The mobile or desktop surface uses stale ticket data after a revisit | An agent can act on old status, assignment, or activity state | Revalidate the ticket resource when the page opens or when the route changes |
| Analytics does not refresh after a status or priority change | SLA hold, due-date, and resolution views can show old timing | Reload per-ticket analytics when the ticket or its SLA-driving fields change |
Key files
| File | Why to read it |
|---|---|
| helpdesk/…/hd_ticket.py | Defines the ticket lifecycle rules for defaults, permissions, status changes, SLA timing, communication updates, and assignment cleanup. |
| helpdesk/…/api.py | Defines ticket creation, retrieval, activity data, assignees, and navigation data used by the desk. |
| helpdesk/…/ticket.py | Defines agent-only bulk replies, attachment linking, direct assignment, and administrator-only ticket deletion. |
| helpdesk/…/ticket_analytics.py | Defines the per-ticket SLA timeline, response-gap metrics, conversation summary, and routing churn data. |
| helpdesk/…/ticket_stats.py | Defines feedback, SLA violation, response-time, resolution-time, and agent comparison statistics. |
| helpdesk/…/hd_ticket.json | Defines the ticket's user-facing fields and the links between lifecycle data such as status, priority, team, contact, customer, and SLA. |
| helpdesk/…/test_hd_ticket.py | Shows the lifecycle guarantees for permissions, assignment, status changes, SLA timing, merge and split behavior, and reply threading. |
| desk/…/Tickets.vue | Shows how agents and customers reach tickets, use views, select rows, export results, and start list-level actions. |
| desk/…/TicketNew.vue | Shows how templates and entered fields become a new ticket for either portal. |
| desk/…/TicketAgent.vue | Shows how the desktop ticket route assembles the header, activity area, sidebar, navigation, live updates, feed readiness, and cached ticket state. |
| desk/…/MobileTicketAgent.vue | Shows how the mobile route presents status, team, assignment, details, activity, communication, custom actions, calls, and cache refresh. |
| desk/…/TicketCallActions.vue | Shows how the workspace exposes make-call and log-call actions for the active ticket. |
| desk/…/TicketMergeModal.vue | Shows the agent-facing merge constraints and the irreversible merge request. |
| desk/…/TicketHeader.vue | Shows the agent-facing status control and protected ticket actions. |
| desk/…/TicketDetailsTab.vue | Shows the agent-facing assignment, editable fields, tags, SLA context, feedback, and related-ticket areas. |
| desk/…/TicketActivityPanel.vue | Shows how communication, ticket history, calls, and analytics become the agent activity workspace. |
| desk/…/AssignTo.vue | Shows the assignment-facing agent picker and the save, activity, and notification relationship. |
| desk/…/TicketAnalyticsTab.vue | Shows how per-ticket analytics appears in the agent workspace and refreshes after status or priority changes. |
| desk/…/useTicket.ts | Shows the shared ticket resource that joins the ticket record with its related workspace resources. |
| desk/…/useTicketNavigation.ts | Shows how the active ticket view supplies next and previous ticket navigation. |