Skip to content

fix: prefill template fields with meta default on new ticket page - #3675

Open
RitvikSardana wants to merge 1 commit into
frappe:developfrom
RitvikSardana:fix/template-field-default
Open

fix: prefill template fields with meta default on new ticket page#3675
RitvikSardana wants to merge 1 commit into
frappe:developfrom
RitvikSardana:fix/template-field-default

Conversation

@RitvikSardana

Copy link
Copy Markdown
Member

Template fields on the new ticket page were always initialized empty, ignoring the field's default set in meta (DocField / Custom Field / Property Setter).

  • get_one API now returns default for each template field
  • New ticket page prefills the field value with it

Test: set a default on an HD Ticket field via Customize Form, add it to the ticket template, open the new ticket page. The field comes prefilled.

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.61%. Comparing base (c037dcf) to head (5cd9b4c).
⚠️ Report is 145 commits behind head on develop.

Files with missing lines Patch % Lines
...elpdesk/helpdesk/doctype/hd_ticket_template/api.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3675      +/-   ##
===========================================
- Coverage    71.63%   71.61%   -0.02%     
===========================================
  Files          145      145              
  Lines        10106    10106              
===========================================
- Hits          7239     7237       -2     
- Misses        2867     2869       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RitvikSardana
RitvikSardana marked this pull request as ready for review August 6, 2026 07:46
@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The Check-default normalization bug should be fixed before merging.

A raw Frappe default of "0" is truthy in JavaScript, so unchecked template fields render and submit as enabled.

Files Needing Attention: desk/src/pages/ticket/TicketNew.vue

Fix All in Claude Code Fix All in Codex

Reviews (1): Last reviewed commit: "fix: prefill template fields with meta d..." | Re-trigger Greptile

function setupTemplateFields(fields) {
fields.forEach((field: Field) => {
templateFields[field.fieldname] = "";
templateFields[field.fieldname] = field.default || "";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Check defaults invert false values

When a Check field has Frappe's string default "0", this assignment preserves the nonempty string and UniInput treats it as truthy, causing an unchecked field to display “Yes” and submit the wrong value.

Knowledge Base Used: Helpdesk core doctypes: agents, teams, customers, knowledge base, and support config

Fix in Claude Code Fix in Codex

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.

2 participants