Create work item tickets instead of issues for Service Desk emails

What does this MR do and why?

This MR updates Service Desk email handling to create work item tickets instead of issues when emails are received, supporting the broader Service Desk migration to Work Items.

Key Changes

Backend Changes:

  • Service Desk Handler: Modified Service Desk handler to create work items with ticket type when service_desk_ticket feature flag is enabled.
  • Email Templates: Updated all Service Desk email templates to work with work items instead of issues while maintaining backward compatibility.
  • Mailer Updates: Refactored Service Desk mailer to handle both issues and work item tickets seamlessly.
  • Notification Service: Enhanced to send Service Desk notifications for both Issue and WorkItem noteables.
  • Hierarchy Support: Added support for Epic → Ticket relationships in work item hierarchy.

Email Infrastructure:

  • Headers: Added new X-GitLab-WorkItem-* headers while preserving legacy X-GitLab-Issue-* headers for backward compatibility.
  • Template Variables: Updated template substitution to work with work items.
  • Custom Email Support: Maintained full compatibility with Service Desk custom email functionality.

Feature Flag Behavior

  • When service_desk_ticket is enabled: Creates ticket work items for new Service Desk emails.
  • When service_desk_ticket is disabled: Maintains existing behavior (creates issues).
  • Backward Compatibility: Existing Service Desk issues continue to work normally.

References

Screenshots or screen recordings

With FF off With FF on
Screenshot_2026-01-06_at_7.30.56_pm Screenshot_2026-01-06_at_7.38.36_pm
Screenshot_2026-01-06_at_7.38.21_pm Screenshot_2026-01-06_at_7.38.21_pm

How to set up and validate locally

  1. Enable the service_desk_ticket feature flag.
  2. Set up Service Desk by following the instructions here.
  3. Send an email to create a new ticket.
  4. Navigate to the Service Desk issue list, for example: http://127.0.0.1:3000/private-group-1/private-project-1/-/issues/service_desk.
  5. Verify that the resulting work item is a ticket, not an issue.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Agnes Slota

Merge request reports

Loading