Skip to content

[#159] feat: add custom fields to tickets - #208

Merged
sksingh2005 merged 1 commit into
mnemosyne-systems:mainfrom
Mohamed-Alkafory:feature/custom-fields
Nov 5, 2026
Merged

sksingh2005 merged 1 commit into
mnemosyne-systems:mainfrom
Mohamed-Alkafory:feature/custom-fields

Conversation

@Mohamed-Alkafory

@Mohamed-Alkafory Mohamed-Alkafory commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Closes #159

What this does

Adds admin-defined custom fields to tickets.

  • Definitions (admin only, installation-wide): name, type (text, number, date, select), required, description, sort order, and active flag. Deactivating keeps existing ticket values; deleting permanently removes the field and its values. Select options that are in use can't be removed or renamed.
  • Values: support, user/TAM and superuser can set them when creating a ticket; support can edit them on non-closed tickets. On existing tickets, user/TAM and superuser see them read-only, like Category, and all values become read-only once a ticket is closed.
  • Default is none: with no fields defined, ticket pages are unchanged.
  • Storage: new tables with typed, indexed value columns, so fields can be filtered later through Advanced Search (Advanced search #157).
  • Definitions are cached, and every definition change invalidates the cache.

Screenshots

Screenshot 2026-11-02 222419 Screenshot 2026-11-02 222513 Screenshot 2026-11-02 222832 Screenshot 2026-11-02 223441

@Mohamed-Alkafory

Copy link
Copy Markdown
Contributor Author

@jesperpedersen @sksingh2005 PTAL

@jesperpedersen

Copy link
Copy Markdown
Contributor

@sksingh2005 Can you start on this ?

@sksingh2005

Copy link
Copy Markdown
Collaborator

Yes I would take a look

@sksingh2005 sksingh2005 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the thorough implementation @Mohamed-Alkafory! The core design, role permissions, caching/invalidation, and backend test coverage are
solid.
Before merging, there are two key items that need addressing:

1. Missing sortOrder input in admin UI (Blocker)

CustomFieldFormState and the form submission in src/frontend/src/pages/CustomFieldFormPage.tsx track sortOrder, and the backend supports it, but there is no input control rendered in the UI form. All custom fields created via the UI stay stuck at sortOrder = 0.

  • Fix: Add a numeric input for sortOrder in CustomFieldFormPage.tsx.

2. Unbounded text_value on PostgreSQL B-tree index (Crash risk)

src/backend/main/java/ai/mnemosyne_systems/model/TicketCustomFieldValue.java defines a composite B-tree index idx_ticket_custom_field_text on (custom_field_id, text_value). In PostgreSQL, B-tree index entries cannot exceed ~2,704 bytes. Submitting text larger than that will cause PostgreSQL to throw a fatal index row size exceeds btree maximum error on insert/update.

  • Fix: Add max-length validation in TicketCustomFieldService.java (e.g. max 1,000 or 2,000 chars) before persisting TYPE_TEXT values.

Minor Suggestion

  • In CustomFieldResource.java, validate that SELECT custom fields have at least one option line defined upon creation.

@Mohamed-Alkafory

Copy link
Copy Markdown
Contributor Author

@sksingh2005 Take a look

@sksingh2005 sksingh2005 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The code changes look great now @Mohamed-Alkafory!
Could you please attach a couple of quick screenshots of the UI in pr description please or screen cast as it would be great for further contributors.

  1. The Custom Fields admin management pages (/custom-fields list and create/edit form).
  2. A ticket create and ticket detail page showing custom fields populated in the top section.

@Mohamed-Alkafory

Copy link
Copy Markdown
Contributor Author

@sksingh2005 Does this look good, or would you like me to add any additional screenshots?

@sksingh2005 sksingh2005 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM .Thanks

@sksingh2005

Copy link
Copy Markdown
Collaborator

@jesperpedersen PTAL

@sksingh2005
sksingh2005 merged commit bf2d8f7 into mnemosyne-systems:main Nov 5, 2026
2 checks passed
@sksingh2005

Copy link
Copy Markdown
Collaborator

@jesperpedersen is little busy with pgmoneta and other work. He will review shortly.
Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom fields

3 participants