Move_item_to_board mutation

Can we get an example on how to use the move_item_to_board mutation especially when it comes to including column and subitem column mappings.

When column mapping argument is not included it works, but when included I get this error: ‘{“error_code”:“GraphqlGeneralError”,“status_code”:200,“error_message”:“Columns mapping is not in the expected format”,“error_data”:{}}’ and I did include ‘API-Version: 2023-10’ in the header.

Thanks

1 Like

Hi Wandile,
I don’t have any answers, I’m here to wait with you.
I am running a mutation as per below,

mutation {
  move_item_to_board (board_id:5339528423, group_id: "topics", item_id:5528230293 , columns_mapping: [
  {source:"name", target: "name"},
  {source:"board_relation", target: "connect_boards2"},
  {source:"link", target:null},
  {source:"link_to_accounts2", target:null},
  {source:"mirror", target:null},
  {source:"status2", target:null},
  {source:"status", target:null},
  {source:"text", target:null},
  {source:"text8", target:null},
  {source:"mirror6", target:null},
  {source:"date1", target:null},
  {source:"date3", target:null},
  {source:"date15", target:null},
  {source:"date_1", target:null},
  {source:"date", target:null},
  {source:"status9", target:null},
  {source:"formula", target:null}]) {
    id
  }
}

and i’m getting

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

But to me I feel like I have followed the api docs to the letter.

Please note that you must specify the mapping for every column when using this argument. You can specify the target as null if you don’t want to map a column, but doing so means that the column’s data will be lost.

is it - null or “null” ?

Do I need to include {source: “subitems”, target: null } ?

Also, is it really necessary to force mapping every column? will my mutation be void if another user adds an additional column to the board?

2 Likes

I am having the same issue same error, “columns mapping is not in the expected format”

I tried this just mapping to a board with 1 text column and keep getting this error

mutation {
  move_item_to_board(
    board_id: 7229739249,
    group_id: "topics",
    item_id: 7229804428,
    columns_mapping: 
      {source: "text4", target: "text__1"}
    
  ) {id}
}

You query the board for all of the columns at runtime - then you always get all of them, and can use that to generate the object.

I did this and it doesnt work! I made a board with 1 text column, and I get the same error as the others above.

Workaround was to:

  1. Status change to trigger automation
  2. Get full item information and store
  3. Another status change to trigger the monday native move automation
  4. Wait a few seconds for item to be present on new board
  5. Update the missing values like connected columns, files on the new board via the API using the item ID and new board columns.

Hopefully, someone confirms this issue is real, and the way to get it fixed, as the reference doesnt seem to work.

Looking more closely - use GraphQL variables, don’t try to put objects into the query string. The query is a string, not an object like in REST.

You can put placeholders for variables in the string, then provide the variable values alongside the string in the request.

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

2 Likes

Thanks how do you suggest the mutation should be written?

It is far more useful to learn the concept and pattern of GraphQL variables, than just get a prewritten query. Its a pattern that will get used repeatedly.

1 Like

Ok will test out, the link is very helpful!