Learn how to filter, read, update, and clear the dependency column on monday boards using the platform API
The dependency column allows you to set up connections between items in the same board. They can then be visually represented in the Gantt View or Widget, or combined with automations. The API allows you to read, filter, update, and clear the dependency column.
Read a dependency column
You can query the dependency column using the column_values object that enables you to return column-specific subfields by sending a fragment in your query. Values for the dependency column are of the DependencyValue type.
query {
items (ids:[1234567890, 9876543210]) {
column_values (types: dependency) {
... on DependencyValue {
linked_item_ids
}
}
}
}const query = `query($itemIds: [ID!], $columnType:[ColumnType!]) { items (ids:$itemIds) { id column_values (types:$columnType) { column { title id } ... on DependencyValue { linked_item_ids } } } }`;
const variables = {
itemIds: [9571351485, 9572374902],
columnType: "dependency"
};
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 dependent items, separated by commas. |
id ID! | The column's unique identifier. |
linked_item_ids ID! | The unique identifiers of the 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 dependency 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 dependency column's supported operators and compare values.
| Operators | Compare values |
|---|---|
any_of | The item IDs to filter by |
not_any_of | The item IDs to filter by |
is_empty | null |
is_not_empty | null |
Examples
The following example returns all items on the specified board that are dependent on item 9876543210.
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "dependent_on"
compare_value: [9876543210]
operator: any_of
}
]
}
) {
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: "dependency_mksvv00d",
compare_value: [9572374902],
operator: "any_of",
};
const response = await mondayApiClient.request(query, variables);Update a dependency column
You can update a dependency 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
To add a dependent-on item to the dependency column, send the item IDs as an array. You will get an error if the items do not belong to the connected board.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"dependency\":{\"item_ids\":[\"11223344\",\"44332211\"]}}"
) {
id
}
}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({
dependency_mksvv00d: { // dependency_mksvv00d is the column ID
item_ids: ["9572374902"]
}
}),
};
const response = await mondayApiClient.request(query, variables); Clear a dependency column
You can also clear a dependency 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: "{\"dependent_on\": 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({
dependency_mksvv00d: null // dependency_mksvv00d is the column ID
}),
};
const response = await mondayApiClient.request(query, variables); 