I am not able to update subitems via API

In short, I have items with subitems. At the moment subitems have only two fields, the name and a text field called “Description”.

I’m trying to update its values through PHP API with this code:

$query = 'mutation ($boardId: Int!, $itemId: Int!, $columnValues: JSON!) { 
    change_multiple_column_values (
        board_id: $boardId,
        item_id: $itemId,
        column_values: $columnValues
    ) { 
        id
    }
}';

$columns = [
    "name" => "some text here",
    "description" => "some text here"
];

$variables = [
    'boardId' => 0123456789, //subitems have their own board Id https://community.monday.com/t/updating-subitems-via-api/16626
    'itemId' => (int) 123456,
    'columnValues' => json_encode($columns)
];

$data = [
    'query' => $query,
    'variables' => $variables
];

$client = new Client();

$options = [
    'headers' => [
        'Content-Type' => 'application/json',
        'Authorization' => XXXXX
    ],
    'json' => $data
];

And I get this errors:

 Array (
    [error_code] => InvalidColumnIdException
    [status_code] => 200
    [error_message] => This column ID doesn't exist for the board
    [error_data] => Array (
        [column_id] => description
        [board_id] =>
        [error_reason] => store.monday.automation.error.missing_column
    )
)

In a near future, we want to have more custom fields, how can I update name + custom fields via API?

hi @pablo.lopez.sf ,

a few things to confirm:

  1. The board Id you are using is the sub-item board id?

  2. The item Id you are using is the sub item in question you want to update, correct?

  3. It seems to me, the column id (not title) is not “description” based on the response error. Have you checked the columns ID? It is likely “text” or something like that. If you are not sure how, you need to have developer mode turned on in your monday.labs. And then go to the column in question on the board (after it refreshes) and click the column menu to get the id.

image

image

If all of these are correct then there might be something wrong with the code itself. But based on the error, my money is on the column ID being incorrect.

Thanks Chris, now I can see the ID and with this it works!

1 Like

Glad it worked! It you ever need support just let me know!