API Playground -Copy_items_to_group error

Hi,

I am kind of new to GraphQL. I am trying to create items in my board 6187373144 after the creating a new group in this board. The items that I want to create is the items resulting from a filter column from board 6187370124. I have created the new group and fetched the items that I want to create in the board 6187373144. But I am struggling with the creation of the items on this board.

This is the code I have so far.

# 1. Execute the CreateGroup mutation to create a new group in board 6187373144

mutation CreateGroup($groupName: String!) {
create_group(
board_id: 6187373144,
group_name: $groupName
) {
id
title
}
}

# 2. Execute the GetItems query to fetch items based on the filter values in board 6187370124.

query GetItems($filter: [String!]!) {
items_page_by_column_values (
board_id: 6187370124,
columns: [
{ column_id: “status4”, column_values: $filter }
]
) {
items {
id
name
}
}
}

# 3. For each fetched item into the newly created group - NOT WORKING

mutation CopyItemsToGroup($groupId: ID!, $itemIds: [ID!]!) {
copy_item_to_group(
group_id: $groupId,
items_ids: $itemIds
) {
id
}
}

This is the error I am getting.

Please, help!

Hello there @norma0485,

That mutation does not exist.

You can use something like this:

mutation {
  duplicate_item (board_id: 1234567890, item_id: 9876543210, with_updates: true) {
    id
  }
}

The item_id would be the item you want to copy. The board_id would be the board in which the new item will be created.

If the target board is a different board from the source board, if you want, you can then move the item with a mutation like this one:

mutation {
  move_item_to_group (item_id: 1234567890, group_id: "group_one") {
    id
  }
}

I hope that helps!

Cheers,
Matias

Hi Matias,

The code you provided will only work for a specific item selected. I want to duplicate sorted items in board (6187370124) and then move them to the next board (6187373144).

mutation {
duplicate_item (board_id: 6187370124, item_id: $itemIds, with_updates: true) {
id
}
}

I am trying this mutation, but I am getting the following error:

{
“errors”: [
{
“message”: “Variable $itemIds is used by anonymous mutation but not declared”,
“locations”: [
{
“line”: 70,
“column”: 50
}
],
“path”: [
“mutation”,
“duplicate_item”,
“item_id”
],
“extensions”: {
“code”: “variableNotDefined”,
“variableName”: “itemIds”
}
},
{
“message”: “Operation name is required when multiple operations are present”,
“locations”: [
{
“line”: 69,
“column”: 1
}
],
“path”: ,
“extensions”: {
“code”: “uniquelyNamedOperations”
}
}
],
“account_id”: 3491933
}

Thanks for your support.