Skip to content

fix: ticket template fields in ticket Edit#6185

Merged
pjamsheer merged 4 commits into
stagingfrom
hd_ticket_field_staging
Jun 2, 2026
Merged

fix: ticket template fields in ticket Edit#6185
pjamsheer merged 4 commits into
stagingfrom
hd_ticket_field_staging

Conversation

@pjamsheer
Copy link
Copy Markdown
Contributor

This pull request refactors the ticket editing workflow to improve field handling and validation for the ticket edit form. The main changes focus on always loading field templates from the default template, simplifying field filtering, and ensuring all required fields are validated before submission. Additionally, the backend now returns the full ticket document, allowing access to all custom fields.

Frontend improvements to ticket editing:

  • The ticket edit form (TicketEdit.vue) now always loads field definitions from the "Default" template, ensuring consistency and availability of all custom fields. Fallback fields are only injected if the template fails to provide fields. [1] [2]
  • Field filtering for display has been simplified—no longer limited to just "priority" and "process" fields, but instead all visible fields are considered.
  • Field value assignment is now more robust, automatically mapping both standard and custom field values from the ticket document to the form fields.
  • Form submission now validates all required fields (not just "priority" and "process") and provides user-friendly dialogs for any missing required information.

Backend improvements:

  • The backend get_ticket_details method now returns the entire ticket document (including all custom fields), rather than a limited set of fields, enabling the frontend to access all necessary data for rendering and editing.

Code cleanup:

  • Deployment logic for TicketCustomer.vue and TicketNew.vue has been removed from the deployment script, possibly because these files are no longer needed or are handled elsewhere.

Copilot AI review requested due to automatic review settings June 1, 2026 18:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Helpdesk ticket edit flow so the frontend loads ticket field definitions from the “Default” ticket template and the backend returns the full HD Ticket document (including custom fields), enabling broader field rendering and validation during ticket edits.

Changes:

  • Frontend: Ticket edit form now loads fields from the “Default” template and maps ticket document values into the form model.
  • Frontend: Required-field validation expanded beyond priority/process to all required template fields plus subject/description.
  • Backend: get_ticket_details now returns HD Ticket as a full as_dict() payload instead of a limited subset.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
one_fm/public/js/form_overrides/hd_ticket/TicketEdit.vue Loads Default template fields, maps values from full ticket doc, and validates required fields before update.
one_fm/overrides/hd_ticket.py Returns the full HD Ticket document from get_ticket_details.
one_fm/after_migrate/execute.py Removes deployment steps for TicketCustomer/TicketNew from the ticket views deployment helper.
Comments suppressed due to low confidence (1)

one_fm/public/js/form_overrides/hd_ticket/TicketEdit.vue:195

  • fetchTicketDetails() calls setupCustomizations() even when no template fields were loaded (e.g., template fetch fails), and oldFields is only initialized when the template returns fields. In that failure path, fallback fields are injected later in onMounted(), but customizations/filters won’t be set up for those injected fields (and oldFields remains []), which can break field behavior.
    const templateRes = await call("helpdesk.helpdesk.doctype.hd_ticket_template.api.get_one", {
      name: "Default",
    });
    
    if (templateRes && templateRes.fields && templateRes.fields.length) {
      templateData.value.fields = templateRes.fields;
      oldFields = JSON.parse(JSON.stringify(templateRes.fields));
    }

    for (const field of templateData.value.fields) {
      const key = field.fieldname;
      // Try to get custom field value from ticket document
      const customKey = key.startsWith("custom_") ? key : `custom_${key}`;
      const value = (data?.[customKey] ?? data?.[key] ?? "");
      templateFields[key] = value;
    }

    setupCustomizations(templateData, {
      doc: templateFields,
      call,
      router,
      $dialog,
      applyFilters,
    });


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/public/js/form_overrides/hd_ticket/TicketEdit.vue
Comment thread one_fm/public/js/form_overrides/hd_ticket/TicketEdit.vue
Comment thread one_fm/overrides/hd_ticket.py
Comment thread one_fm/after_migrate/execute.py
@pjamsheer pjamsheer requested a review from NoBoneZ June 1, 2026 20:58
@pjamsheer pjamsheer merged commit dcbde83 into staging Jun 2, 2026
4 of 7 checks passed
@pjamsheer pjamsheer deleted the hd_ticket_field_staging branch June 2, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants