Columns mapping is not in the expected format

I am struggling to use ‘move_item_to_board’ despite having what I believe to be the correct column mapping. I keep getting an error saying the column mapping is not correct. I have outputted the source board’s columns to double check, but it looks correct to me:

[0] [nodemon] restarting due to changes…
[0] [nodemon] starting node ./src/app.js
[0] (node:91487) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
[0] (Use node --trace-deprecation ... to show where the warning was created)
[0] Transform text integration listening on port 8302
[0] Retrieved columns for board 1817479461: [
[0] { id: ‘name’, type: ‘name’, title: ‘Name’ },
[0] { id: ‘subitems_mkka1888’, type: ‘subtasks’, title: ‘Subitems’ },
[0] { id: ‘listen_link_Mjj8kFYr’, type: ‘link’, title: ‘Listen’ },
[0] { id: ‘creation_log_mkkapaxr’, type: ‘creation_log’, title: ‘SCOUT’ },
[0] { id: ‘a_r_Mjj8FbRY’, type: ‘people’, title: ‘A&R’ },
[0] {
[0] id: ‘artist_s__Mjj8LVeF’,
[0] type: ‘board_relation’,
[0] title: ‘Artist(s)’
[0] },
[0] { id: ‘track_name_Mjj836UG’, type: ‘text’, title: ‘Track Name’ },
[0] { id: ‘type_Mjj8bI1y’, type: ‘status’, title: ‘Type’ },
[0] {
[0] id: ‘discovery_source_Mjj8MZuS’,
[0] type: ‘status’,
[0] title: ‘Discovery Source’
[0] },
[0] { id: ‘status_Mjj8Yxsa’, type: ‘status’, title: ‘Status’ },
[0] {
[0] id: ‘color_Mjj8BZHX’,
[0] type: ‘status’,
[0] title: ‘Primary Outreach Channel’
[0] },
[0] {
[0] id: ‘daily_streams_Mjj8AfSw’,
[0] type: ‘numbers’,
[0] title: ‘Daily Streams’
[0] },
[0] {
[0] id: ‘type_of_offer_Mjj8nZaN’,
[0] type: ‘status’,
[0] title: ‘Type of Offer’
[0] },
[0] {
[0] id: ‘advance_amount__usd__Mjj8AFik’,
[0] type: ‘numbers’,
[0] title: ‘Advance (USD)’
[0] },
[0] {
[0] id: ‘marketing_budget__usd__Mjj8n7SN’,
[0] type: ‘numbers’,
[0] title: ‘Marketing Budget (USD)’
[0] },
[0] { id: ‘important_notes_Mjj8UUeP’, type: ‘text’, title: ‘Notes’ },
[0] {
[0] id: ‘last_updated_Mjj8wT4g’,
[0] type: ‘last_updated’,
[0] title: ‘Last updated’
[0] },
[0] { id: ‘item_id_mkmfdk81’, type: ‘text’, title: ‘Item ID’ }
[0] ]
[0] Move item response: {
[0] errors: [
[0] {
[0] message: ‘Columns mapping is not in the expected format’,
[0] locations: [Array],
[0] path: [Array],
[0] extensions: [Object]
[0] }
[0] ],
[0] status_code: 200,
[0] error_data: {},
[0] error_code: ‘GraphqlGeneralError’,
[0] error_message: ‘Columns mapping is not in the expected format’,
[0] account_id: 24099521
[0] }


This is my function:

const moveProject = async (token, currentBoardId, itemId) => {
const boardConfig = workspaceConfigs.BOARDS[currentBoardId];

if (!boardConfig) {
console.error(‘Board not found!’);
return;
}

const nextBoardId = boardConfig.nextBoardId;
const nextBoardGroupId = boardConfig.nextBoardGroupId; // Get the target group ID from your config

if (!nextBoardGroupId) {
console.error(‘Group ID not configured for board’, nextBoardId);
return;
}

try {
const mondayClient = initMondayClient({ token });
mondayClient.setApiVersion(‘2024-10’);

// (Optional) Retrieve and log the target board's columns for debugging
await getBoardColumns(token, currentBoardId);

// IMPORTANT: When using columns_mapping, the API expects a complete mapping for all columns.
// If a column should not be mapped, set its target to null.
// The complete mapping below is based on the target board's columns you retrieved.
const mutationQuery = /* GraphQL */ `

mutation ($nextBoardId: ID!, $itemId: ID!, $nextBoardGroupId: ID!) {
move_item_to_board(
board_id: $nextBoardId,
group_id: $nextBoardGroupId,
item_id: $itemId,
columns_mapping: [
{ source: “name”, target: “name” },
{ source: “subitems_mkka1888”, target: “subitems_mkka1888” },
{ source: “listen_link_Mjj8kFYr”, target: “listen_link_Mjj8kFYr” },
{ source: “creation_log_mkkapaxr”, target: “creation_log_mkkapaxr” },
{ source: “a_r_Mjj8FbRY”, target: “a_r_Mjj8FbRY” },
{ source: “artist_s__Mjj8LVeF”, target: “artist_s__Mjj8LVeF” },
{ source: “track_name_Mjj836UG”, target: “track_name_Mjj836UG” },
{ source: “type_Mjj8bI1y”, target: “type_Mjj8bI1y” },
{ source: “discovery_source_Mjj8MZuS”, target: “discovery_source_Mjj8MZuS” },
{ source: “status_Mjj8Yxsa”, target: “status_Mjj8Yxsa” },
{ source: “color_Mjj8BZHX”, target: “color_Mjj8BZHX” },
{ source: “daily_streams_Mjj8AfSw”, target: “daily_streams_Mjj8AfSw” },
{ source: “type_of_offer_Mjj8nZaN”, target: “type_of_offer_Mjj8nZaN” },
{ source: “advance_amount__usd__Mjj8AFik”, target: “advance_amount__usd__Mjj8AFik” },
{ source: “marketing_budget__usd__Mjj8n7SN”, target: “marketing_budget__usd__Mjj8n7SN” },
{ source: “important_notes_Mjj8UUeP”, target: “important_notes_Mjj8UUeP” },
{ source: “last_updated_Mjj8wT4g”, target: “last_updated_Mjj8wT4g” },
{ source: “item_id_mkmfdk81”, target: “item_id_mkmnz5dt” }
]
) {
id
}
}
`;

const mutationVariables = { nextBoardId, itemId, nextBoardGroupId };
const response = await mondayClient.api(mutationQuery, { variables: mutationVariables });

console.log("Move item response:", response);
return response;

} catch (error) {
console.error(“Error moving item:”, error);
}
};

Hey @dan13l

Bill here from monday.com :wave:

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,
Bill

Hi Bill,

I got this working eventually, although don’t remember exactly what I did. If I were to guess, I think it was because it turns out that a connected column was at fault. One board had the connected column, but then the other board did not have that same connection.