Learn how to filter, read, create, update, and clear the dropdown column on monday boards using the platform API
The dropdown column lets users select one or more options from a predefined list.
Via the API, the dropdown column supports read, filter, create, update, and clear operations.
Column Type | Implementation Type | Supported Operations |
|---|---|---|
|
|
|
Queries
Dropdown columns can be queried through the column_values field on items queries using an inline fragment on DropdownValue.
query {
items(ids: [1234567890, 9876543210]) {
column_values {
... on DropdownValue {
values {
label
id
}
column {
id
}
}
}
}
}const query = `
query($itemIds: [ID!], $columnType: [ColumnType!]) {
items(ids: $itemIds) {
id
column_values(types: $columnType) {
column { title id }
... on DropdownValue {
values {
label
id
}
}
}
}
}
`;
const variables = {
itemIds: [9571351485, 9572374902],
columnType: "dropdown",
};
const response = await mondayApiClient.request(query, variables);Fields
You can use the following fields to specify what information your DropdownValue implementation will return.
| Field | Description |
|---|---|
column Column! | The column the value belongs to. |
id ID! | The dropdown column's unique identifier. |
text String | The column's value as text. Returns null if the column has an empty value. |
type ColumnType! | The column's type. |
value JSON | The column's JSON-formatted raw value. |
values [DropdownValueOption!]! | The selected dropdown options for this item. |
Filter
You can filter items by dropdown values using the items_page object. The dropdown column supports the following operators:
Operators | Compare Values |
|---|---|
|
|
|
|
|
|
|
|
| Partial or full label text as a string |
| Partial or full label text as a string |
Example
The following example returns all items on the specified board whose labels contain the text "Marketing".
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "dropdown"
compare_value: ["Marketing"]
operator: contains_text
}
]
}
) {
items {
id
name
}
}
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `
query ($boardId: [ID!], $columnId: ID!, $operator: ItemsQueryRuleOperator!, $compareValue: CompareValue!) {
boards(ids: $boardId) {
items_page(
query_params: {
rules: [
{ column_id: $columnId, compare_value: $compareValue, operator: $operator }
]
}
) {
items { id name }
}
}
}
`;
const variables = {
boardId: 9571351437,
columnId: "dropdown_mksrbr89",
compareValue: ["Marketing"],
operator: "contains_text",
};
const response = await mondayApiClient.request(query, variables);Mutations
Create
Required scope:boards:write
The create_dropdown_column mutation creates a new dropdown column with strongly typed settings. You can specify which fields to return in the mutation response.
mutation {
create_dropdown_column(
board_id: 1234567890
id: "project_category"
title: "Project Category"
defaults: {
label_limit_count: 1
limit_select: true
labels: [
{ label: "HR" }
{ label: "R&D" }
{ label: "IT" }
]
}
description: "The project's category."
) {
id
title
description
}
}Update
You can update an email column using change_simple_column_value or change_multiple_column_values. You can send values as simple strings or JSON objects, depending on the mutation you choose.
NoteYou can't mix dropdown label text and label IDs in the same string value.
change_simple_column_value
change_simple_column_valueSend label IDs or label text as a comma-separated string in value.
If the label doesn't exist, the API returns an error that includes the existing labels. To automatically create missing labels, use create_labels_if_missing: true.
Update by IDs
mutation {
change_simple_column_value(
item_id: 9876543210
board_id: 1234567890
column_id: "dropdown"
value: "1,2"
) {
id
}
}Update by labels
mutation {
change_simple_column_value(
item_id: 9876543210
board_id: 1234567890
column_id: "dropdown"
value: "Cookie, Cupcake"
) {
id
}
}change_multiple_column_values
change_multiple_column_valuesSend the dropdown IDs or label text as a JSON object in column_values.
JSON with IDs
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"dropdown\": {\"ids\": [\"1\"]}}"
) {
id
}
}JSON with labels
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"dropdown\": {\"labels\": [\"My label\"]}}"
) {
id
}
}Add a dropdown value
You can also add a new dropdown label and assign it to an item with change_simple_column_value.
mutation {
change_simple_column_value(
item_id: 1234567890
board_id: 9876543210
column_id: "dropdown"
value: "New dropdown value"
create_labels_if_missing: true
) {
id
}
}Clear
You can clear a dropdown column using change_multiple_column_values by passing null or an empty labels array in column_values.
mutation {
change_multiple_column_values(
item_id: 123456789
board_id: 987654321
column_values: "{\"dropdown\": {\"labels\": []}}"
) {
id
}
}