Learn how to filter, read, update, and clear the connect boards column on monday boards using the platform API
The connect boards column links an item on the board with an item(s) on a different board(s). The API allows you to read, filter, create, update, and clear the connect boards column.
Read a connect boards column
You can query the connect boards column using the column_values object. It enables you to return column-specific subfields by sending a fragment in your query. Values for the connect boards column are of the BoardRelationValue type.
query {
items(
ids: [
1234567890
9876543210
]
) {
column_values {
... on BoardRelationValue {
linked_item_ids
linked_items {
id
}
}
}
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `query($itemIds: [ID!]) { items (ids:$itemIds) { column_values { value ... on BoardRelationValue { linked_item_ids linked_items { id } } } } }`;
const variables = {
itemIds: [9571351485, 9572374902],
};
const response = await mondayApiClient.request(query, variables);Fields
| Field | Description |
|---|---|
column Column! | The column the value belongs to. |
display_value String! | The names of the linked items, separated by commas. |
id ID! | The column's unique identifier. |
linked_item_ids [ID!]! | The unique identifiers of linked items. |
linked_items [Item!]! | The linked items. |
text String | The column's value as text. This field will always return null. Use display_value instead. |
type ColumnType! | The column's type. |
updated_at Date | The column's last updated date. |
value JSON | The column's JSON-formatted raw value. This field will always return null. Use linked_items and linked_item_ids instead. |
Filter a connect boards column
Using the items_page object, you can easily filter a board's items by specific columns or column values. The table below contains the connect boards column's supported operators and compare values.
| Operators | Compare values |
|---|---|
any_of | The connected items' IDs to filter by |
not_any_of | The connected items' IDs to filter by |
is_empty | [] |
is_not_empty | [] |
contains_text | The partial or whole item name to filter by as a string |
not_contains_text | The partial or whole item name to filter by as a string |
Examples
The following example returns all items on the specified board connected to an item whose name contains "Test."
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "connect_boards"
compare_value: ["Test"]
operator: contains_text
}
]
}
) {
items {
id
name
}
}
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `query ($board_id: [ID!], $column_id: ID!, $operator: ItemsQueryRuleOperator!, $compare_value:CompareValue!) { boards (ids: $board_id) { items_page (query_params: {rules: [{column_id: $column_id, compare_value: $compare_value, operator:$operator}]}) { items { id name } } } }`;
const variables = {
board_id: 9571351437,
column_id: "connect_boards",
compare_value: ["Test"], // this is the name to search in the connected items
operator: "contains_text",
};
const response = await mondayApiClient.request(query, variables);Create a connect board column
Required scope:boards:write
The create_column mutation creates a connect board column via the API. You can specify which fields to return in the mutation response.
mutation {
create_column(
board_id: 1234567890
title: "Related items (Board 9876543210)"
column_type: board_relation
defaults: {
boardIds: [9876543210]
allowMultipleItems: true
allowCreateReflectionColumn: true
}
) {
id
title
type
}
}{
"data": {
"create_column": {
"id": "YOUR_COLUMN_ID",
"title": "Related items (Board 9876543210)",
"type": "board_relation"
}
},
"extensions": {
"request_id": "YOUR_REQUEST_ID"
}
}Arguments
You can use the following arguments to define the new column's characteristics.
Argument | Description |
|---|---|
board_id | The unique identifier of the board where the new column should be created. |
capabilities | The new column's capabilities configuration. If omitted, defaults apply: on multi-level boards, status columns are created with the calculated capability enabled. To override this default on multi-level boards, pass an empty argument to create the column without capabilities. |
column_type | The type of column to create. |
defaults | The new column's defaults. Accepts JSON objects and JSON strings. For JSON objects, query |
description | The new column's description. |
id | The column's user-specified unique identifier. The mutation will fail if it does not meet any of the following requirements:
|
title | The new column's title. |
The following example returns all items on the specified board connected to an item whose name contains "Test."
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "connect_boards"
compare_value: ["Test"]
operator: contains_text
}
]
}
) {
items {
id
name
}
}
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `query ($board_id: [ID!], $column_id: ID!, $operator: ItemsQueryRuleOperator!, $compare_value:CompareValue!) { boards (ids: $board_id) { items_page (query_params: {rules: [{column_id: $column_id, compare_value: $compare_value, operator:$operator}]}) { items { id name } } } }`;
const variables = {
board_id: 9571351437,
column_id: "connect_boards",
compare_value: ["Test"], // this is the name to search in the connected items
operator: "contains_text",
};
const response = await mondayApiClient.request(query, variables);Update a connect boards column
You can update a connect boards column using the change_multiple_column_values mutation and passing a JSON string in the column_values argument. Simple string updates are not supported.
JSON
WarningBoards can't be connected using the API - only items on boards that are already connected. Let's say your want to connect an item from Board B to Board A, but the boards are not yet connected. You must first manually connect Boards B and A, and then you can use the API to connect the items.
If you try to connect items from boards that are not connected, you will get an error.
To update a connect boards column, send the item IDs to be linked as an array.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"connect_boards\":{\"item_ids\":[\"44332211\",\"11223344\"]}}"
) {
id
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `mutation ($myBoardId:ID!, $myItemId:ID!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }`;
const variables = {
myBoardId: 9571351437,
myItemId: 9571351485,
myColumnValues: JSON.stringify({
board_relation_mksr721a: {item_ids: [9393173469, 9393175000]} // board_relation_mksr721a is the column ID
}),
};
const response = await mondayApiClient.request(query, variables); Clear a connect boards column
You can also clear a connect boards column using the change_multiple_column_values mutation and passing null or an empty object in the column_values argument.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"connect_boards\": null}"
) {
id
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `mutation ($myBoardId:ID!, $myItemId:ID!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }`;
const variables = {
myBoardId: 9571351437,
myItemId: 9571351485,
myColumnValues: JSON.stringify({
board_relation_mksr721a: null // board_relation_mksr721a is the column ID
}),
};
const response = await mondayApiClient.request(query, variables); 