Skip to main content

Lists

A StandardList defines a fixed set of named values for a LIST-typed value type field. Each item has a key and optional colors for UI rendering.

Definition

{
"name": "my-project.contractType",
"items": [
{ "key": "permanent", "color": "#1a7f37", "backgroundColor": "#dafbe1" },
{ "key": "fixedTerm", "color": "#9a6700", "backgroundColor": "#fff8c5" },
{ "key": "freelance", "color": "#0969da", "backgroundColor": "#ddf4ff" }
]
}
PropertyTypeDescription
nameTypeFQNUnique identifier for this list, used to reference it from value types.
itemsStandardListItem[]The available values in this list.

StandardListItem

PropertyTypeDescription
keystringThe stored value. Must be unique within the list.
colorstringCSS color value. See rendering behaviour below.
backgroundColorstringCSS background color. See rendering behaviour below.

Color rendering behaviour

How a list item is rendered in the UI depends on which color properties are set:

colorbackgroundColorRendering
Plain text
setSmall colored dot next to the text
setsetText in color on a backgroundColor background (badge)

Only add colors when they carry meaning. A priority or severity list benefits from color; a list of contract types or categories usually does not.

Referencing a list from a value type

Set dataType to LIST and list to the TypeFQN of the StandardList:

{
"name": "contractType",
"dataType": "LIST",
"list": "my-project.contractType"
}

Where to define lists

Lists are defined in the lists array of any class file. A list can be referenced by any class in the same namespace, regardless of which file it is defined in.

Cross-file list references

Define the list once in the file where it belongs logically, then reference it by TypeFQN from any other class. In this example my-project.ticketPriority is defined on serviceTicket.json and reused by my-project.changeRequest in a separate file:

serviceTicket.json — defines the list:

{
"class": "my-project.serviceTicket",
"type": "ABSTRACT",
"inherits": "commons.dossier",

"valueTypes": [
{ "name": "priority", "dataType": "LIST", "list": "my-project.ticketPriority" }
],

"lists": [
{
"name": "my-project.ticketPriority",
"items": [
{ "key": "low", "color": "#1a7f37", "backgroundColor": "#dafbe1" },
{ "key": "medium", "color": "#9a6700", "backgroundColor": "#fff8c5" },
{ "key": "high", "color": "#cf222e", "backgroundColor": "#ffebe9" }
]
}
]
}

changeRequest.json — references the same list without redefining it:

{
"class": "my-project.changeRequest",
"type": "BASIC",
"inherits": "my-project.serviceTicket",

"valueTypes": [
{ "name": "impactLevel", "dataType": "LIST", "list": "my-project.ticketPriority" }
]
}
{
"class": "my-project.employmentAgreement",
"type": "BASIC",
"inherits": "commons.agreement",

"valueTypes": [
{ "name": "contractType", "dataType": "LIST", "list": "my-project.contractType" }
],

"lists": [
{
"name": "my-project.contractType",
"items": [
{ "key": "permanent", "color": "#1a7f37", "backgroundColor": "#dafbe1" },
{ "key": "fixedTerm", "color": "#9a6700", "backgroundColor": "#fff8c5" },
{ "key": "freelance", "color": "#0969da", "backgroundColor": "#ddf4ff" }
]
}
]
}