Ticket management
Ticket management is the Helpdesk domain for turning a customer request into owned work with a clear state, service target, and outcome. The Frappe backend is the source of record for each ticket, while the agent desk gives support staff a focused way to find tickets, update their work, and see customer context.
Ticket domain
Ticket record
An HD Ticket is the central record for a support request. It gives the request a subject and description, then connects that request to its status, priority, type, team, customer, contact, service target, origin, communications, activity history, and feedback. These links let the ticket serve both as the work item for an agent and as the customer-facing record of the request. The record also keeps response and resolution times so the result can be measured after the work ends.
References: helpdesk/…/hd_ticket.json• L11-77 helpdesk/…/hd_ticket.json• L184-367 helpdesk/…/hd_ticket.json• L441-567
Customer context
Customer context connects a ticket to the person who raised it and, when known, to the customer organization that person represents. The backend can match the requester's email to a Contact and can derive a single linked HD Customer; agents can correct or choose the customer when the contact belongs to more than one customer. A portal user can only raise or change a ticket for the contact owned by that session. Email matching is a fallback only when the contact is not already owned by another user.
Ticket visibility follows the same relationship. A customer can see tickets tied to the session contact, requester, or managed customer records. An agent's access can also depend on assignment and team restrictions. A customer cannot select a customer that is not linked to the ticket contact, and the customer-facing template controls which readable fields the customer may fill after creation.
References: helpdesk/…/hd_ticket.py• L307-391 helpdesk/…/customer_edit_controller.py• L16-33 helpdesk/…/customer_edit_controller.py• L52-133 helpdesk/…/api.py• L85-140 helpdesk/…/test_hd_ticket.py• L1114-1360
Classification and ownership
Classification gives a support team a shared way to sort and route work. A ticket type can supply a default priority, while Helpdesk settings provide fallback values. Priority names remain configurable, so an installation can use its own levels.
Ownership has two related parts: the HD Team identifies the team responsible for the work, and assignees identify the agents who should act on it. Team membership and assignment rules support access and work distribution. If an open ticket moves to another team, an assignment that no longer fits the new team can be removed when an active assignment rule applies.
References: helpdesk/…/hd_ticket.py• L393-399 helpdesk/…/hd_ticket.py• L455-517 helpdesk/…/api.py• L685-714 helpdesk/…/hd_ticket.json• L119-146
Ticket lifecycle
Intake and creation
Ticket intake accepts a subject, a detailed request, optional attachments, and any fields exposed by a ticket template. The customer portal and the agent desk use the same ticket domain, while portal intake can record where the customer started. Templates can hide fields from customers, set field rules, provide starting text, and guide values such as priority. The desk checks required fields before submission.
On creation, the backend fills core defaults such as requester, ticket type, priority, status, contact, customer, and a private ticket key. The first description becomes the initial linked communication. A portal origin is reduced to a trusted entry point such as Article, Search, Ticket List, Closed Ticket, Direct, or External; article and search details are kept only when valid and readable. Depending on settings and origin, the system can also send an acknowledgement to the requester. This creates a usable ticket record before an agent starts work and gives later replies a communication history to extend.
The main intake-to-work relationship is shown below.
flowchart LR
Request[Customer or agent request] --> Intake[Ticket intake]
Intake --> Origin[Trusted ticket origin]
Intake --> Record[HD Ticket record]
Record --> Context[Contact and customer context]
Record --> Work[Status, priority, team, and assignees]
Record --> Thread[Linked communication history]
Work --> Desk[Agent desk]
Thread --> Desk
Desk --> Outcome[Resolved ticket]
References: helpdesk/…/api.py• L23-48 helpdesk/…/hd_ticket.py• L105-129 helpdesk/…/hd_ticket.py• L210-224 helpdesk/…/hd_ticket.json• L439-494 helpdesk/…/test_hd_ticket.py• L146-149
Status and resolution
A ticket status is a configurable label with a status category. The categories are Open, Paused, and Resolved: open work continues against service targets, paused work stops the service clock, and resolved work stops the resolution timer. The agent view shows enabled agent labels, while a status may expose a different label to customers when the customer-facing wording needs to be clearer.
Moving a ticket into a resolved category records the resolution time. Moving it away from resolution clears that outcome, so the record reflects the current work state rather than an old result. Closing a ticket after it is already resolved does not start a second resolution interval. An incoming customer reply reopens the ticket through the configured reopen status, and an outgoing agent reply records the first and latest agent response.
Resolution can also require customer feedback after an agent has replied. Customers may change only fields opened by the ticket template and may close a ticket through the customer view; they cannot change a closed or rated ticket, and feedback cannot be changed once given. A portal reply can reopen an eligible ticket, but it does not bypass the closed or rated ticket lock.
References: helpdesk/…/hd_ticket.py• L400-450 helpdesk/…/hd_ticket.py• L1005-1036 helpdesk/…/hd_ticket.py• L1148-1201 helpdesk/…/customer_edit_controller.py• L52-121 helpdesk/…/test_hd_ticket.py• L644-819 helpdesk/…/test_hd_ticket.py• L2423-2455
Service targets
A service level agreement (SLA) attaches response and resolution targets to a ticket. The backend selects an applicable SLA and stores the due times, hold state, and agreement result on the ticket. The agent desk presents first-response and resolution progress beside the contact, including due dates, hold time, fulfilment, and delay when those values exist. The customer view exposes the expected first response and resolution targets that the ticket template allows the customer to see.
SLA state follows ticket status. A paused ticket shows a paused target and keeps hold information. Returning to open work extends the resolution target by the hold time. A ticket without a matching SLA has no service deadlines to report, but the system still records a resolution date when the ticket is resolved. If an SLA is removed after a breach, the breach facts remain available even though its active targets are cleared.
References: helpdesk/…/hd_ticket.py• L1038-1099 helpdesk/…/hd_ticket.json• L184-243 helpdesk/…/test_hd_ticket.py• L489-716 helpdesk/…/test_hd_ticket.py• L2142-2305
Ticket relationships
Tickets can be split when one request contains separate work and merged when two records represent the same work. A split creates a new open ticket for the later part of the conversation and starts it without the source ticket's origin or active SLA. Only an agent with write access to the source ticket can split it, and the selected communication must belong to that ticket. A merge closes the source ticket and points it to the target while moving its history to the target. These relationships preserve the history while keeping active work in one place.
If a customer replies to a merged ticket, the backend follows the merge chain to the final active target. A broken or cyclic chain is not followed, so the reply remains on the ticket that received it instead of being lost or sent into a loop. The workspace also uses recent tickets from the same contact or customer as context. Similar-ticket results can remain empty when no match is available.
References: helpdesk/…/api.py• L269-405 helpdesk/…/api.py• L402-505 helpdesk/…/hd_ticket.py• L1112-1154 helpdesk/…/test_hd_ticket.py• L821-1047 helpdesk/…/api.py• L627-682
Agent desk
Ticket list
The ticket list is the agent's work queue and search surface. It supports saved and public views, filters, sorting, row navigation, selection, export, and agent-only bulk actions. Status, priority, assignment, team, customer, and SLA results are visible as work signals so an agent can decide what to open next.
The same list route serves the customer portal with customer-safe labels and actions. The backend still applies ticket visibility rules before a row or ticket detail is returned. New tickets refresh the agent list, while saved views let agents keep different work slices for different needs.
References: desk/…/Tickets.vue• L1-69 desk/…/Tickets.vue• L128-248 desk/…/Tickets.vue• L372-477 helpdesk/…/hd_ticket.py• L1219-1383 helpdesk/…/api.py• L518-602
Ticket workspace
The agent ticket workspace combines the request, its conversation, and its operating context. The header exposes status and configured actions. The activity area holds the ticket's communications and internal activity, while the side panel keeps the contact, SLA view, assignee, core fields, custom fields, tags, feedback, and related tickets close to the work.
The workspace keeps one ticket view across desktop and mobile. On mobile, details and activity use tabs, while team, assignee, status, and custom actions remain available in the compact header. Field changes are saved against the backend ticket and refresh related activity. Assignment changes use agent records and can show current availability, which helps an agent make an informed handoff without changing the ticket's customer context. Live updates and cached revalidation keep the view current when an agent returns to a ticket or another user changes it.
References: desk/…/TicketAgent.vue• L1-18 desk/…/TicketAgent.vue• L101-228 desk/…/MobileTicketAgent.vue• L34-178 desk/…/MobileTicketAgent.vue• L326-459 desk/…/TicketDetailsTab.vue• L1-141 desk/…/AssignTo.vue• L294-306
Customer ticket view
The customer ticket view gives the requester a safe way to follow the request, add a reply, review allowed ticket details, and close the ticket. It presents customer-facing status labels, priority, expected service targets, and template fields that are not hidden from customers. The customer can add formatted text and private file attachments while the ticket remains open.
The view adapts its layout without changing the ticket's meaning. Desktop shows the conversation beside the ticket sidebar, while mobile switches between activity and details. A customer can see an outside-hours notice when support timing matters, and a close action can lead to feedback when the configured rule requires it.
References: desk/…/TicketCustomer.vue• L25-105 desk/…/TicketCustomer.vue• L161-195 desk/…/TicketCustomer.vue• L271-395 desk/…/TicketCustomerTemplateFields.vue• L1-98 helpdesk/…/customer_edit_controller.py• L111-133
Related pages
Use these pages for the two detailed parts of the ticket domain:
- Ticket lifecycle orchestration explains creation, retrieval, editing, navigation, and agent-facing actions in more detail.
- Ticket conversations and communications explains messages, comments, email, attachments, and the communication history linked to a ticket.
Change checklist
When these files or sections are changed, remember to consider these:
- When status labels or categories change, check backend default and reopen status selection, customer-facing labels, desk status lists, SLA timing, and resolution reporting.
- When ticket or template fields change, check both creation-time field exposure and the agent side panel. A field can be valid at intake but absent from later ticket editing.
- When customer-edit rules change, check template visibility, customer-writable fields, customer reopen behavior, feedback finality, and the closed or rated ticket lock together.
- When contact or customer rules change, check portal ownership checks, ticket visibility, customer auto-selection, multi-customer validation, and the recent-ticket context shown to agents.
- When team or assignment rules change, check agent visibility filters, assignment cleanup after team changes, and the desk assignment control.
- When reply or status hooks change, check first-response timestamps, customer reopen behavior, resolution dates, feedback requirements, and email threading together.
- When origin fields or portal links change, check the trusted entry-point mapping, readable article validation, search text limits, external source precedence, and split-ticket behavior.
- When merge or split behavior changes, check activity and attachment movement, merge-chain reply routing, origin retention, and the safe handling of missing or cyclic targets.
- When split authorization or source validation changes, check write access under team restrictions, communication ownership, and the guarantee that a rejected split creates no new ticket.
- When SLA matching changes, check the no-SLA state, the original SLA clock, hold-time accounting, breach facts, and resolution metrics together.
- When template visibility or customer close rules change, check the customer detail view, mobile tabs, allowed reply fields, feedback gate, and customer-facing status labels together.
- When activity refresh or list updates change, check cached ticket revalidation, live update handling, active viewer state, and the agent list refresh together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A portal user selects a contact other than the contact tied to the session | Ticket creation or contact change is rejected | Keep portal contact ownership checks aligned with the contact-to-user relationship. |
| A contact is linked to multiple customers and a portal request does not name one | Ticket creation stops because the customer context is unclear | Require an explicit customer or keep one customer link for portal requests. |
| A customer submits a field that the template does not allow after creation | The update is denied instead of silently changing the ticket | Keep template visibility and customer edit rules aligned. |
| A customer changes feedback after rating the ticket | The update is denied because feedback is final | Treat feedback fields as immutable after the first rating or option. |
| An agent changes the team while an active assignment rule leaves the assignee outside that team | The assignment can be cleared on an open ticket | Review team membership and assignment rules together. |
| An agent sends an email reply while reply email is enabled but no outgoing account is available | The reply fails instead of reaching the requester | Configure a valid outgoing account or use the non-email communication path intentionally. |
| A non-agent tries to update a closed or rated ticket | The update is denied even if the user can read the ticket | Treat closure and rating as customer-edit locks. |
| A status is disabled or has an unexpected category | It may disappear from the agent menu or change SLA and resolution behavior | Validate status configuration as a label, customer label, category, and enabled option. |
| A status or origin field is supplied by an untrusted portal request | The server ignores the supplied business value | Derive status and origin on the server from allowed settings and validated source data. |
| A ticket loses its matching SLA after a priority or rule change | Active deadlines disappear, while old breach facts must still remain | Keep SLA detach and reattach rules separate from the record of past response and resolution results. |
| A reply arrives on a merged ticket with a missing or cyclic merge target | The reply cannot be redirected safely | Stop at an unresolved chain and handle the reply on its current ticket. |
| An agent without write access tries to split a ticket, or the selected communication is not part of a ticket | The split is rejected and no new ticket is created | Check source-ticket write permission and communication ownership before copying any records. |
| A customer tries to send an empty message or sends while an attachment is still uploading | The reply is not submitted | Require message content and wait for uploads to finish before enabling send. |
Key files
| File | Why to read it |
|---|---|
| helpdesk/…/hd_ticket.json | Defines the ticket's business fields, origin links, service measures, feedback data, and role-level access. |
| helpdesk/…/hd_ticket.py | Shows the ticket rules for defaults, context, status changes, SLA fields, permissions, assignments, origins, and communication-driven updates. |
| helpdesk/…/customer_edit_controller.py | Defines the fields customers may fill, change, close, or rate and the locks applied after feedback or closure. |
| helpdesk/…/api.py | Describes the backend boundary used by the desk for creation, retrieval, activities, related tickets, split, and merge actions. |
| helpdesk/…/test_hd_ticket.py | States the domain contracts for visibility, status and SLA timing, resolution facts, merge and split behavior, and communication threading. |
| desk/…/Tickets.vue | Shows the ticket queue, views, work signals, customer-safe presentation, and bulk agent actions. |
| desk/…/TicketAgent.vue | Shows the desktop agent ticket workspace, live refresh, navigation, and shared ticket state. |
| desk/…/MobileTicketAgent.vue | Shows the mobile agent workspace and how core work controls remain available on a small screen. |
| desk/…/TicketCustomer.vue | Shows the customer ticket view, customer replies, close and feedback flow, and live refresh. |
| desk/…/TicketCustomerTemplateFields.vue | Shows which status, priority, SLA, and template fields the customer can see. |
| helpdesk/…/hd_ticket_status.json | Defines the status category model and the separate agent and customer labels. |
| helpdesk/…/hd_team.json | Defines teams, team members, assignment rules, and restriction overrides. |