Move Item Mutation Error

Hello, everyone.
I am using Monday.com API graphql query and I get some errors while I am using move item to board query

Here is my query

mutation {
  moveItem: move_item_to_board (
    board_id: 1886238032, 
    group_id: "topics", 
    item_id: 1887657797, 
    columns_mapping: [
      { source: "text", target: "text" }, 
      {source:"text5", target:"text_1"}, 
      {source:"status7", target:"status7"}, 
      {source:"status_1", target:"status_1"}, 
      {source:"phone", target:"phone"}, 
      {source:"email", target:"email"}, 
    ]
  ) {
    id
  }
}

But I got this error

{
  "error_message": "Columns mapping is not in the expected format",
  "error_code": "GraphqlGeneralError",
  "error_data": {},
  "status_code": 200,
  "account_id": 20770082
}

Why do I get this error? Did I set up the column mapping incorrectly?
I would appreciate it if someone could help me with my problem?
Thank you,

Hello there @Bolt!

Are you sure you have columns with those exact IDs both in your source board and in the target board? If you don’t have the columns with the specified IDs, then this will not work.

Looking forward to hearing from you :smile:

Cheers,
Matias

Hello, @Matias.Monday

Thank you for your reply.
Sure, I have columns with those exact IDs both in my source board and in the target board, but it didnt work.
I look forward to your response.
Thanks.

Hello again @Bolt,

Would you be able to please fill this form adding as much information as possible to it (such as account ID, board IDs, item IDs, timestamps, etc.) so that our team can take a look into it?

Something you have to remember is you must list EVERY column of the source board, even the ones you’re not copying. The ones you are not copying over should have null as the target column. EXCEPT for any formula, mirror, and connect board columns (and possibly dependency as well). You’ll want to confirm through testing which types you have to leave out.

Connect boards seem to map based on column titles being identical between the boards as well as the connected boards also being identical. Whether specified by you in the mutation or not. IF the titles and connected boards match, it will copy the item linkage over.

Hello, @Matias.Monday

That is a great point as well @codyfrisch! Thank you!

And hello @Bolt ! I think you might have clicked on “send” before writing your message.

@codyfrisch
Thanks for your reply,
Of course, I listed all columns from the source board, and set the target column as null, but the result was the same before.
@Matias.Monday
Sorry for the blank reply.
Could you please show me an exmaple for move item mutation?
I am using JacaScript.
I look forward to your response.
Thanks.

Hello there @Bolt,

You can find an example here!

Using JS it could look something like this:

const myHeaders = new Headers();
myHeaders.append("Authorization", "RELEVANT_API_KEY");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "query": "mutation { move_item_to_board (board_id:1122334455, group_id: \"topics\", item_id:1234567890) { id } }"
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://api.monday.com/v2", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

I hope that helps!

Cheers,
Matias

That example query doesn’t work.

column_mappings is a required argument for move_item_to_board, and it is not even in the example.

@Bolt

I would create the mapping object, and pass it as a variable


mutation ($columnMapping: ColumnMappingInput!) {
  moveItem: move_item_to_board (
    board_id: 1886238032, 
    group_id: "topics", 
    item_id: 1887657797, 
    columns_mapping: $columnMapping
  ) {
    id
  }
}

Then along size the query, pass this as a variable:

{
  columnMapping: [
      { source: "text", target: "text" }, 
      {source:"text5", target:"text_1"}, 
      {source:"status7", target:"status7"}, 
      {source:"status_1", target:"status_1"}, 
      {source:"phone", target:"phone"}, 
      {source:"email", target:"email"}, 
    ]
}

Trying to embed anything with quotes into the query string (or mutation string) is going to cause issues.

Pass the object in variables. You should probably convert all of your other values in the query to variables too.

https://graphql.org/learn/queries/#variables

Hello again,

Thank you for providing that extra information @codyfrisch !

Just in case, the example given does work. It will not map everything with a mapping object, but it does perform the action of moving the item:

Hi, I’m experiencing this exact error. My move_item_to_board was working flawlessly until a few days ago then suddenly stopped and started telling me that my group_id isn’t correct.

image

Any help would be appreciated.

Hello there @tomaz309 and welcome to the community!

Would you be able to please fill this form adding as much information as possible to it (such as account ID, board IDs, item IDs, timestamps, etc.) so that our team can take a look into it?

Cheers,
Matias

Hi quick update here,
now the same query’s response is different
I get now:

[200] Columns mapping is not in the expected format [ Error Code: GraphqlGeneralError / Error Details: {} ]

This is the query (board and item id’s anonymized)
mutation {
move_item_to_board(
board_id: 123456789,
group_id: “new_group__1”,
item_id: 987654321,
columns_mapping: [
{source: “status8”, target: “status__1”},
{source: “connect_boards”, target: null},
{source: “board_relation”, target: “connect_boards__1”},
{source: “date”, target: “date”},
{source: “hour7”, target: “hour7”},
{source: “hour0”, target: “hour0”},
{source: “formula”, target: null},
{source: “label”, target: “label”},
{source: “text8”, target: “text8”},
{source: “text2”, target: “text2”},
{source: “color5”, target: “color5”},
{source: “color2”, target: “color2”},
{source: “text5”, target: “text5”},
{source: “label__1”, target: null}
]
) {
id
}
}

Hello there!

We found the source of this issue to be the presence of a formula column in the mutation. Formula columns should not be part of the mutation.

We reached out to the documentation team so that we can add this as a note :smile:

Hi, @Matias.Monday
Thanks for your reply.
Could you please let me know which part is the formula column in the mutation?
Thanks

Hi @Bolt,

In the provided mutation, this line attempts to map the formula column: {source: “formula”, target: null},.

Best,
Rachel

Hi, @rachelatmonday
As you can see in this query, there is no formula column.

mutation {
  moveItem: move_item_to_board (
    board_id: 1886238032, 
    group_id: "topics", 
    item_id: 1887657797, 
    columns_mapping: [
      { source: "text", target: "text" }, 
      {source:"text5", target:"text_1"}, 
      {source:"status7", target:"status7"}, 
      {source:"status_1", target:"status_1"}, 
      {source:"phone", target:"phone"}, 
      {source:"email", target:"email"}, 
    ]
  ) {
    id
  }
}

This is the first query which i have tried.
Could you please explain about this?
Thanks.

Hi @Bolt,

Matias replied to someone else and said they had a formula column in there, so I thought you were referring to their mutation! You are correct that you do not have a formula column.

I replicated your board structure on my test board and ran the following mutation without any errors in the playground. When I copy and pasted the query you sent, I got the same error you did.

I would suggest using this one, verifying your column IDs on both the target and source board, and making sure you have the correct board and item ID.

  moveItem: move_item_to_board (
    board_id: 5031483671, 
    group_id: "topics", 
    item_id: 7352877398, 
    columns_mapping: [
      {source: "text__1", target: "text__1"}, 
      {source:"text_1__1", target:"text_1__1"}, 
      {source:"status__1", target:"status__1"}, 
      {source:"status_1__1", target:"status_1__1"}, 
      {source:"phone__1", target:"phone__1"}, 
      {source:"email__1", target:"email__1"}, 
    ]
  ) {
    id
  }
}

If you still have issues, please open a support request for the fastest resolution. They have extra permissions that enable them to access account and board data and make it easier to resolve your query.

Best,
Rachel

@rachelatmonday I’m wondering in the same vein as formula columns - what about all of the other read only column types? auto ID, item ID, progress, mirror, etc.