mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
Add MondayCom options for changing column values
This commit is contained in:
@@ -487,6 +487,64 @@ export class MondayCom implements INodeType {
|
||||
responseData = await mondayComApiRequest.call(this, body);
|
||||
responseData = responseData.data.create_item;
|
||||
}
|
||||
if (operation === 'changeColumnValue') {
|
||||
const boardId = parseInt(this.getNodeParameter('boardId', i) as string, 10);
|
||||
const itemId = parseInt((this.getNodeParameter('itemId', i) as string), 10);
|
||||
const columnId = this.getNodeParameter('columnId', i) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
|
||||
const body: IGraphqlBody = {
|
||||
query:
|
||||
`mutation ($boardId: Int!, $itemId: Int!, $columnId: String!, $value: JSON!) {
|
||||
change_column_value (board_id: $boardId, item_id: $itemId, column_id: $columnId, value: $value) {
|
||||
id
|
||||
}
|
||||
}`,
|
||||
variables: {
|
||||
boardId,
|
||||
itemId,
|
||||
columnId,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
JSON.parse(value);
|
||||
} catch (e) {
|
||||
throw new Error('Custom Values must be a valid JSON');
|
||||
}
|
||||
body.variables.value = JSON.stringify(JSON.parse(value));
|
||||
|
||||
responseData = await mondayComApiRequest.call(this, body);
|
||||
responseData = responseData.data.change_column_value;
|
||||
}
|
||||
if (operation === 'changeMultipleColumnValues') {
|
||||
const boardId = parseInt(this.getNodeParameter('boardId', i) as string, 10);
|
||||
const itemId = parseInt((this.getNodeParameter('itemId', i) as string), 10);
|
||||
const columnValues = this.getNodeParameter('columnValues', i) as string;
|
||||
|
||||
const body: IGraphqlBody = {
|
||||
query:
|
||||
`mutation ($boardId: Int!, $itemId: Int!, $columnValues: JSON!) {
|
||||
change_multiple_column_values (board_id: $boardId, item_id: $itemId, column_values: $columnValues) {
|
||||
id
|
||||
}
|
||||
}`,
|
||||
variables: {
|
||||
boardId,
|
||||
itemId,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
JSON.parse(columnValues);
|
||||
} catch (e) {
|
||||
throw new Error('Custom Values must be a valid JSON');
|
||||
}
|
||||
body.variables.columnValues = JSON.stringify(JSON.parse(columnValues));
|
||||
|
||||
responseData = await mondayComApiRequest.call(this, body);
|
||||
responseData = responseData.data.change_multiple_column_values;
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const itemId = parseInt((this.getNodeParameter('itemId', i) as string), 10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user