Files
wekan/docs/Features/Cards/CustomFields
Lauri Ojansivu 7e1f9e89eb Docs: every feature topic in one folder under docs/Features, each with README.md as its main page.
- The General/ level is gone: its 109 files moved up into the folders of the
  same name, and its topic table is the "Shared topics" section of
  Features.md.
- Accessibility is one folder, docs/Features/Accessibility/, with the Admin
  Panel's accessibility page in it.
- Every folder's main page is README.md (110 X/X.md pages renamed with git mv,
  five merged with an existing README.md, 26 index pages added for folders
  that had none), so a folder opened on GitHub shows its page.
- The 73 "# Moved" forwarding pages are deleted, with the folders that held
  only them; every link that went to one goes to its final page.
- docs/Features/README.md has the website's "Features in WeKan" overview,
  each feature linking to its page here.

1,129 Markdown links in 262 files and 352 doc paths in code, tests, compose,
snap and release files follow. tests/docsFeaturesLayout.test.cjs fails when
General/ or a "# Moved" page comes back, a folder has no README.md, or a
relative link in the docs or README.md does not resolve.

Thanks to xet7 !
2026-11-24 20:02:06 +02:00
..

Custom Fields

Custom Fields issue

What it is

Custom fields are a board's own extra fields for its cards, beside the built-in title, dates, members and labels: a release version, a budget, a customer, a checkbox, a choice from a list. A board member who may change the board defines a field once for the board - its name and type - and then each card can carry a value for it, shown on the opened card and, when chosen, on the minicard. Number and date fields can also be summed or ranged at the top of each list.

Read more

To translators, about the word Custom

See other feature for description of Custom Customize Translations

How to use it

The screenshots below are from an older WeKan; the steps under each are the current menus.

1) Open the board's custom fields: Board Settings → Card (the board's cog menu), then the Custom Fields section of Card Settings. (In the older WeKan of the screenshot this was Board hamburger menu / Custom Fields.)

Custom Field Step 1

2) Create a field: click + (Create Field) under the section's fields, fill in Name and Type, the type's settings and the checkboxes, and click Save.

  • Type is one of Text, Number, Date, Dropdown List, Dropdown (multi-select), Checkbox, Currency and String Template. It cannot be changed after the field is created.
  • Currency asks for a Currency Code; Dropdown List and the multi-select for their List Options (press Enter to add more); String Template for a Format and a Separator (below).
  • Show this field on card, Add field to new cards, Add field to all cards and Show field label on minicard decide where the field appears; Show sum of fields at top of list is offered for Number and Currency fields.
  • Only on these card kinds limits the field to Story or Task cards (none ticked: every card).
  • A board admin also sees Visible only to board admins and Read-only: every member sees the value, only board admins change it (Admin only and display order).
Custom Field Step 1

3) Add it to a card: open the card and click the hamburger at the end of its Custom Fields heading. The Edit custom fields popup lists every custom field of the board, ticked when it is on this card. (In the older screenshot: Card Details hamburger menu / Edit custom fields.)

Custom Field Step 1

4) Click your custom field's name to put it on the card (click again to take it off). The pencil beside it edits the field; Create Field and Link fields to another card are at the bottom of the popup.

Custom Field Step 1

5) Set its value: click the field on the card (its title or its value) and enter or choose the value, then Save.

Custom Field Step 1

6) The custom field is shown at the minicard and the card details.

Custom Field Step 1

Editing or deleting a field: in Card Settings' Custom Fields, the field's hamburger opens its edit form, with Save and Delete; in the card's Edit custom fields popup, its pencil does the same.

How the numbers are calculated

  • Sum at top of list (sumCustomFieldValues and numberFieldStats in models/lib/customFieldsSum.js, shown by client/components/lists/listHeader.js): for every Number field with Show sum of fields at top of list, the values on the list's cards that are not archived (per swimlane when the list is shown in swimlanes) are added up and shown as ∑ N. Only Number fields are summed: the checkbox is also offered for a Currency field, but the list header reads only type: 'number'. A card without the field or with an empty value adds 0; a text value is read as a number with a comma or a dot as the decimal mark, and one that is not a number is skipped. The badge's tooltip adds the smallest and largest value and how many of the list's cards have a value, as (min–max, count/total).
  • Date fields with showSumAtTopOfList (the form does not offer the checkbox for a Date field; it can be set through the REST API) show the earliest and latest date on the list's cards instead of a sum (dateFieldRange), as one date when they are the same.
  • Currency values are formatted with the browser's Intl.NumberFormat in the field's currency.
  • String Template regular expressions: the pattern is at most 200 characters and the value at most 10,000, and on the server it runs with a 50 ms time limit (models/lib/customFieldStringTemplate.js, server/lib/boundedRegex.js).
  • Display order: a new field's sort is the number of fields the board already has, so it goes last (Admin only and display order).

How it works in WeKan

  • Definitions are the customFields collection (models/customFields.js): boardIds, name, type, settings (currencyCode, dropdownItems, stringtemplateFormat, stringtemplateSeparator), showOnCard, automaticallyOnCard, alwaysOnCard, showLabelOnMiniCard, cardKinds, showSumAtTopOfList, readOnly, adminOnly and sort. Its REST API and server hooks are in server/models/customFields.js; every writing REST handler needs board write access.
  • A card's values are cards.customFields, a list of { _id, value }; models/lib/customFieldsWD.js joins them with the definitions of the card's current board, in display order, and skips values whose definition is not on that board.
  • The edit form is createCustomFieldPopup in client/components/sidebar/sidebarCustomFields.jade; Card Settings' Custom Fields section is models/lib/cardSettingsCustomFields.js; the card's popup and value editors are client/components/cards/cardCustomFields.jade.
  • Tests: tests/customFieldsWD.test.cjs, tests/customFieldsSum.test.cjs, tests/customFieldStringTemplate.test.cjs, tests/cardSettingsCustomFields.test.cjs, tests/customFieldInteraction.test.cjs, tests/restCustomFieldUpdate.test.cjs, tests/restCustomFieldDelete.test.cjs and the browser tests tests/playwright/specs/rest-custom-field-update.e2e.js, rest-custom-field-delete.e2e.js, rest-dropdown-item-update.e2e.js and minicard-filled-custom-fields-6811.e2e.js.

String Template variables

A String Template formats each nonempty value entered on the card, then joins those results using the field's separator. The same format appears on minicards and in card details. Available variables are:

Variable Value
%{value} The current item entered in this custom field
%{card.title} Card title
%{board.title} Board title
%{list.title} List title
%{swimlane.title} Swimlane title

Names are case-insensitive. The spelling {%card.title} (percent sign inside the braces) also works. Titles and formats update while the card is open. Linked cards use their source card's context, just as they use its custom-field values. Unknown variables or unavailable context remain literal text. These variables do not expose arbitrary document properties or other custom fields.

Append |urlencode to encode a value as a URL parameter. For example, a label printer link can use this format:

[Print label](https://printer.example/print?label=%{value|urlencode}&card=%{card.title|urlencode}&lane=%{swimlane.title|urlencode})

Spaces, Unicode and characters such as &, # and ? are encoded within each parameter, rather than changing the URL's structure. The normal Markdown viewer still handles links and sanitization. Variable contents are substituted once; text inside a card title is never evaluated as another template.

The existing regular-expression replacement applies to the current item and can be mixed with the variables:

${"regex":"^([A-Z]{2})-(.*)$","flags":"i","replace":"$1 / $2"}

Invalid regex definitions remain visible instead of preventing card rendering. This is the Custom Fields String Template feature requested in #3815; Rules action templates use their separate {card}, {board} and other rule variables.

To copy field values between two cards, for example from each worker's card to a main card on another board, see Linked custom fields.

Commits