Mutation Update not working

Hello, I Tested in playground one mutation for updated column in board , when i used graphql not working, my response request is undefined

mutation {
change_simple_column_value (board_id: 1320360345, item_id: 1338898345, column_id: "texto9", value: "dsfsdfsdfds") {
id
}
}

IDs Modificates

GraphQl with node.js

query = mutation ($board_id: Int!, $column_id: String!, $item_id: Int!, $column_value: String!) {
  change_simple_column_value (board_id: $board_id, column_id: $column_id, item_id: $item_id, column_value: $column_value) {
    id
  }
}

 variables {
  board_id: 1320360345,
  column_id: 'texto9',
  item_id: 1338898345,
  column_value: 'oioioioiio'
}
this.mondayApi.api(query, { variables });

Hi @GabriellaSelbach!

It sounds like the request is working in your GraphiQL environment (the Developer’s Playground), but not in your code in Node.js, is that right? Or is it not working in both?

In order to pass variables, you will need to make sure to use the JSON.stringify() function so that the variables will be in the correct format.

It should look something like this:
image

Do you mind giving this a try and letting me know if it works for you?

Hello @Helen !
Thank your help. In Playoud monday its working, in code nodejs the query direct in code without used graphql also working. Now when used query with graphql not working

the query return error:

errors: [
    {
      message: "Field 'change_simple_column_value' is missing required arguments: column_id, value",
      locations: [Array],
      fields: [Array]
    },
    {
      message: "Field 'change_simple_column_value' doesn't accept argument 'column_values'",
      locations: [Array],
      fields: [Array]
    },
    {
      message: 'Variable $column_values is declared by  but not used',
      locations: [Array],
      fields: [Array]
    }

],

I tried to use function graphql:

updatedColum(body: UpdatedMultipleDTO) {
    return {
      operation: 'change_simple_column_value',
      variables: {
        board_id: {
          value: this.config.boardFeedbackId,
          required: true,
          type: 'Int',
        },
        item_id: {
          value: body.itemId,
          required: true,
          type: 'Int',
        },
        column_values: {
          type: 'JSON',
          value: JSON.stringify(body.newData),
        },
      },
      fields: ['id'],
    };
  }

Here my query direct code, That working :
mutation { change_multiple_column_values( board_id: 1320360890, item_id:1489846068, column_values: "{\"status8\":\"0\",\"texto7\":\"gabriella staniecki\"}" ) { id } }

Here query using graqhql:

mutation ($board_id: Int!, $item_id: Int!, $column_values: JSON) {
  change_simple_column_value (board_id: $board_id, item_id: $item_id, column_values: $column_values) {
    id
  }
}
var {
  board_id: 1320360890,
  item_id: 1489846068,
  column_values: '{"status8":"0","texto7":"gabriella staniecki"}'
}

Hi @GabriellaSelbach!

I see that within your code you’re actually using separate methods, both the change_simple_column_value() API method, as well as the change_multiple_column_values() API method.

Because these two methods utilize different arguments, this could be why you’re seeing an error. While the change_simple_column_value() method utilizes these arguments:

The change_multiple_column_values() method utilizes these arguments:

Notice how the argument for change_simple_column_value() is “values,” while the argument for change_multiple_column_values() is “column_values.” This explains the error that you’re seeing that you’re missing required arguments in your method!

In general, error messages are super helpful in letting you know what the issue with your code is!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.