Mutation change column value in nodeJS - Dynamic Variable

         axios({
      url: 'https://api.monday.com/v2',headers: {
        Authorization: 'Bearer ' + 'token'
         },
      method: 'post',
      data: {
       query: `mutation {
        change_column_value (board_id: ${id}, item_id: ${pulseid}, column_id: "time1", value:  "\"${points}\"") {
          id
        }
       }`
      }
      }).then(function(result) {
         console.log(result);
         } 
         
      
      ).catch(function (error) {
        console.log(error) 
    });

Also i have tried this one as well.

 query: 
            `mutation change_column_value ($textValue: Integer!){
                change_column_value(
                  board_id: ${id},
                  item_id: ${pulseidusedhere},
                  column_id: ${group},
                  value:$textValue
                ){
                  id
                }
              }
              query variables: {
              textValue: ${JSON.stringify(time)},
              }
              `,
            
      }

Hi I need to give a dynamic variable value every time i iterate through this mutation.

I have tried JSON.stringify() inside the query variable doesn’t works for me.

Any help would be appreciated.

This is what i returned from here…

data: '{"query":"\\n                  mutation change_column_value ($textValue: JSON!){\\n                    change_column_value(\\n                      board_id: 449422451,\\n                      item_id: 454299258,\\n                      column_id: \\"time2\\",\\n                      value:$textValue\\n                    ){\\n                      id\\n                    }\\n                  }\\n                  query variables: {\\n                  textValue: 2075,\\n                  }\\n                  "}',
1 Like

For those wondering about this – adding variables to your query is addressed in our Javascript Quickstart. Check it out here: Quickstart

1 Like