Skip to content

Telling the Analyst a Ticket Is Theirs Developer Guide

Ed Mozley edited this page Sep 24, 2026 · 1 revision

Telling the analyst a ticket is theirs β€” developer guide

User-facing page: Telling the analyst a ticket is theirs.


Why a second event, not a redirect

#148 reported that ticket_assigned reaches the requester rather than the analyst, and proposed changing the recipient.

The data said what that would have cost. Measured against the live ticket table before changing anything: on 38 of 45 assignments the ticket's owner and its assignee are different people, so the proposed recipient = $me would have emailed the wrong analyst in the large majority of cases β€” and, separately, would have stopped telling the requester anything at all.

Measuring the proposal against real rows, rather than reasoning about it, is what turned "fix the recipient" into "add an event". Worth doing before accepting any issue that proposes a one-line change to who gets something.

So ticket_assigned is untouched and keeps its selection keyed on the requester, and analyst_assigned is a new event beside it.

The dispatch

In includes/services/tickets.php, at the point assignment is committed:

sendTemplateEmail($conn, $ticketId, 'ticket_assigned');
if ($newAnalystId !== $actorId) {
    sendTemplateEmail($conn, $ticketId, 'analyst_assigned');
}

The guard is the "assigning to yourself" rule. It compares the new assignee against the actor, not against the previous assignee β€” self-assignment is the case that produces a pointless email, and it is the actor who would receive it.

Placeholders

includes/template_email.php gained assigned_analyst_name, assigned_analyst_email and ticket_url_analyst.

πŸ”΄ [analyst_name] is the ticket's OWNER, not its assignee, and on most desks those differ. It predates this work and is not being changed β€” renaming a placeholder breaks every template that uses it. The editor now says which is which at the point of choosing, because the names alone do not.

ticket_url_analyst points into the inbox; the existing ticket_url points at the requester's portal view. A template addressed to an analyst wants the former, and getting that wrong sends staff to a customer-facing page.

templateEventAudience()

One function answers "who is this template written for", and the settings screen renders it as the Sends to column. Keeping it a function rather than a column in the template row means an event added later cannot forget to declare an audience β€” there is one place that knows, and it is the same place the dispatcher reads.


See also

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Blue sky thinking

Bugs resolved

Links

Clone this wiki locally