NODE JS Query Mutation

Hi!

I am trying to create different subitems through a mutation, wiht information from different arrays. But it only creates one subitem from the first array’s info.

Can someone tell me what its wrong with my code?:

for (let i = 0; i < steps.getsubitems.$return_value.values.length; i++) {

var data = {
query: mutation ($parentitemid: Int!, $itemName: String!, $columnVals: JSON!) { create_subitem ( parent_item_id: $parentitemid, item_name: $itemName, column_values: $columnVals ) { id } },
variables: {
parentitemid: 849540602,
itemName: steps.nodejs_1.$return_value,
columnVals: JSON.stringify({
“texto71” : steps.getsubitems.$return_value.values[i][1],
“texto1” : steps.getsubitems.$return_value.values[i][2],
“texto9” : steps.getsubitems.$return_value.values[i][3],
“texto15”: steps.getsubitems.$return_value.values[i][4],
“texto3”: steps.getsubitems.$return_value.values[i][5],
“texto90”: steps.getsubitems.$return_value.values[i][6],
“texto7”: steps.getsubitems.$return_value.values[i][7],
“texto6”: steps.getsubitems.$return_value.values[i][8],
“texto8”: steps.getsubitems.$return_value.values[i][9],
“n_meros0”: Number(steps.getsubitems.$return_value.values[i][10]),
“measure3”: steps.getsubitems.$return_value.values[i][11],
“measure_”: steps.getsubitems.$return_value.values[i][12],
“price1”: Number(steps.getsubitems.$return_value.values[i][13]),
“price_exw”: Number(steps.getsubitems.return_value.values[i][14]) }) }, }} return await require("@pipedreamhq/platform").axios(this, { url: `https://api.monday.com/v2`, headers: { "Authorization": `{auths.monday.api_key}`,
},
data,
})

Hey @Edeg - is this being done in Javascript?

-Daniel

Hello Daniel,

Sorry for the delay… yes it is, but I already found the solution.

Thanks for your help.

Kind regards!

2 Likes

@Edeg

That’s awesome, thanks so much for keeping us in the loop :slight_smile: If you need anything else, feel free to reach out to the community.

-Alex