Preventing change_multiple_column_values from creating a new column

I’ve noticed when using change_multiple_column_values with a column that doesn’t exist, instead of registering an error or simply doing nothing, it creates that column and populates it. How do I prevent this? I want to make sure that only existing columns are updated.

Hey @Msh
You should first query the structure and check if the column exists.
In case it doesn’t, you need to remove it from your mutation.

Hey @Msh :wave:

that’s quite odd. I’ve just tried using column IDs that do not exist on my board in a change_multiplise_column_values call, and wasn’t able to replicate the behavior. Could you please shed more light on how we could backtrace this, so we can investigate further?

I’m looking forward to hearing from you soon! :slight_smile:

-Alex

I see. Weird behavior…when I try this command on the API playground, it refuses and gives an InvalidColumnIdException error ( “error_reason”: “store.monday.automation.error.missing_column”). But when I issue the exact same command in my program (which uses the javascript mondaySDK), it makes a new column as I described before.

command (sample board/item #'s):
mutation {
change_multiple_column_values (item_id: 1234567, board_id: 7654321, column_values: “{“s_cd”: “s 888” , “s_cd_yy”: “s yy 456” , “area_cd”: “area 2” , “new_col444”: “new col beh444” }”) {
id
}
}

full API playground result:
{
“error_code”: “InvalidColumnIdException”,
“status_code”: 200,
“error_message”: “This column ID doesn’t exist for the board”,
“error_data”: {
“column_id”: “new_col444”,
“error_reason”: “store.monday.automation.error.missing_column”
}
}

@Msh

thank you for shedding more light on this! I’m going to try and reproduce this on my end and I will get back to you as soon as I can with an update. To confirm, I was able to get the same error you’ve mentioned in our API Playground and Postman, so I’m glad we’re aligned there.

-Alex

Hi Alex,

I’m running into a similar issue but while trying to mutate a single column.

With the following output:

{error_data={column_id=“status”, error_reason=store.monday.automation.error.missing_column}, error_code=InvalidColumnIdException, status_code=200.0, error_message=This column ID doesn’t exist for the board}

Another individual column I’m trying to change:
{error_data={column_id=“text1”, error_reason=store.monday.automation.error.missing_column}, error_code=InvalidColumnIdException, error_message=This column ID doesn’t exist for the board, status_code=200.0}

@shaunmb98

Thank you for reaching out to us. To be transparent with you, it seems like you are trying to mutate columns that don’t exist in the board you’e sending the API call to, so this seems like expected behavior right now. Could you please provide the query you are currently using so we could take a further look? Could you also confirm if the board you’re sending the API request to has columns with ID of “text1”, and “status”?

I’d love to confirm my understanding after investigating the exact API call further.

-Alex

Here’s the query I’m using:
query = “mutation($item:Int!, $board:Int!, $val:JSON!, $col:String!){change_column_value(item_id:$item, board_id:$board, column_id:$col, value:$val){id}}”

variables = {
“item” : parseInt(pulseID),
“board” : boardID,
“col” : JSON.stringify(colMappings[i]),
“val” : JSON.stringify(cellValue)
};

The api call:
var url = “https://api.monday.com/v2”;
var options = {
“method” : “post”,
“headers” : {
“Authorization” : key,
},
“payload” : JSON.stringify({
“query” : query,
“variables” : variables
}),
“contentType” : “application/json”
};
var response = UrlFetchApp.fetch(url, options);

And the two column ids:
image
image

@shaunmb98

Thank you for circling back with me!

That does look a bit odd. I would try and check if the board ID matches the board you are looking to update.

Otherwise, I would love to continue investigating this over email so that we can gather more specific detail here. I’ve sent you a DM to troubleshoot further and I appreciate your cooperation thus far!

-Alex