Aworkのタスクを完了する前に依存関係を確認(代替案)

上級

これはIT Ops分野の自動化ワークフローで、44個のノードを含みます。主にIf, Set, Code, Filter, Webhookなどのノードを使用。 Aworkタスクを完了する前に依存関係を確認(フィ野方案)

前提条件
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • ターゲットAPIの認証情報が必要な場合あり

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "93fb8727a95622f4aa18b433e7f50b3d9eefa47fbe8901532956ded5db485301"
  },
  "nodes": [
    {
      "id": "8743a397-a6ca-4325-b0f8-33a34e15b63a",
      "name": "タスクの依存関係を読み込み",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1600,
        -400
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/tasks/{{ $('Webhook call by Awork').item.json.body.entity.id }}/taskdependencies",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "waitBetweenTries": 2000
    },
    {
      "id": "d3ac4527-eb09-49f5-9bff-7d83e494022d",
      "name": "タスク依存関係を集約",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1800,
        -400
      ],
      "parameters": {
        "options": {
          "mergeLists": true
        },
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "taskDependencies",
              "fieldToAggregate": "predecessorId"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1b05f8f7-9451-481d-b2cb-b74c4048f9e0",
      "name": "ワークフロー設定",
      "type": "n8n-nodes-base.set",
      "position": [
        -640,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "20b87314-585f-4b03-a87d-cc1b9ff1f9c2",
              "name": "finishedStateLabels",
              "type": "array",
              "value": "=[\"Fertig\",\"Total fertig\"]"
            },
            {
              "id": "16f603e2-3703-4f47-a1b9-92503eb1ea43",
              "name": "useDependencies",
              "type": "boolean",
              "value": false
            },
            {
              "id": "ffd4703d-be65-4c35-b28c-6cafb1050d13",
              "name": "useTreeStructure",
              "type": "boolean",
              "value": true
            },
            {
              "id": "6adacba5-463e-4d5e-9571-54f1a026cb4d",
              "name": "addComments",
              "type": "boolean",
              "value": true
            },
            {
              "id": "a06d3f03-8c2d-4788-b986-4bfc2b2a37c5",
              "name": "commentTextDependencies",
              "type": "string",
              "value": "Some dependencies not yet finished! Status rolled back!"
            },
            {
              "id": "68e0a3f8-5b43-4b1c-b7c8-174abd4c3754",
              "name": "commentTextTreeStructure",
              "type": "string",
              "value": "Some child tasks not yet finished! Status rolled back!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a610af8c-a4eb-4fa0-987f-8c001f78de20",
      "name": "タスク変更を取得",
      "type": "n8n-nodes-base.set",
      "position": [
        -220,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1e893cd-bdeb-4c9b-8fe0-82dc11c047a7",
              "name": "=changes",
              "type": "array",
              "value": "={{ $('Webhook call by Awork').item.json.body.changes }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "72b495ae-fd9c-4347-ae17-8ba93a3afeb9",
      "name": "タスク変更を分割",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "a4ec9460-d622-4d4b-a31b-ba3705faa88f",
      "name": "タスクステータス変更をフィルタリング",
      "type": "n8n-nodes-base.filter",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "82923633-648e-4ef0-82dc-cbe35de925b3",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.property }}",
              "rightValue": "TaskStatusId"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cc8d6540-122e-48e0-bcf7-91331eea11d4",
      "name": "タスク完了確認",
      "type": "n8n-nodes-base.if",
      "position": [
        620,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e4e5890b-588e-41f1-95c1-02e313fda09a",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              },
              "leftValue": "={{ $('Workflow config').item.json.finishedStateLabels }}",
              "rightValue": "={{ $('Webhook call by Awork').item.json.body.entity.taskStatus.name }}"
            },
            {
              "id": "97e159ef-21df-4d1c-bef0-fc7a64ffa0fe",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.entity.taskStatus.type }}",
              "rightValue": "done"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0b19f6d1-2821-49ff-8291-933c26165e93",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1940,
        -660
      ],
      "parameters": {
        "width": 880,
        "height": 1440,
        "content": "## Awork workaround for done tasks with subtasks or dependencies\n\n\nCurrently, [Awork](https://www.awork.com/) does **not** offer direct support for the following functions:\n\n* If a task has subtasks, then it should not be able to be marked as completed while subtasks are still open\n* If a task is dependent on other tasks, then it should not be able to be marked as completed as long as these linked tasks are still open\n\n### This n8n workflow offers the following functions:\n\n* Checking whether all subtasks of a task have been completed before it can be completed \n* Check whether tasks marked as prerequisites have been completed before the task can be marked as completed\n* If the condition for completing a task is not fulfilled, the workflow rolls back the status to the previous status\n* A comment is added to the task as to why this roll back occurred\n* This workflow **does not use** the Awork community nodes package, as this package does not support all API calls and is therefore not used by me. If you would like to use that package, you can find more information at [https://support.awork.com/en/articles/9826591-n8n-integration](https://support.awork.com/en/articles/9826591-n8n-integration) and replace the http nodes with matching community nodes if applicable\n\n\n### The following configuration settings are possible or required in the “Workflow config” node (following the webhook call):\n\n* **finishedStateLabels** (required): Label text of the task status entities that have the “Done” state. Must be stored as an array. Allows you to control whether the workflow is skipped for certain status changes, even if the task has been marked as completed.\n\n* **useDependencies** (optional): Boolean setting as to whether dependencies should be taken into account or not. If true, a task can only be marked as completed if the linked tasks have been marked as completed.\n\n* **useTreeStructure** (optional): Boolean setting whether parent and child tasks are taken into account. If true, then parent tasks can only be marked as completed if all child tasks have been marked as completed.\n\n* **addComments** (optional): Boolean setting as to whether a comment is added to a task if a status change has been undone by the workflow\n\n* **commentTextDependencies** (optional, required if addComments is true): Comment text that is added to a task when the status change is undone for uncompleted tasks on which the current task is dependent. Serves as a hint for the user.\n\n* **commentTextTreeStructure** (optional, required if addComments is true): Comment text that is added to a task when the status change is undone for uncompleted subtasks. Serves as a hint for the user.\n\n## How to use\n\n**Awork configuration**\n\n* Copy this workflow to your n8n installation\n* Add authentication credentials to webhook call node at the start\n\n* Add a new webhook call to Awork (see [https://support.awork.com/en/articles/5415462-webhooks](https://support.awork.com/en/articles/5415462-webhooks)) and configure as required (name, authentication etc.)\n* Configure the webhook to be called on task status changes\n* Enable \"Only events from first level properties\" to reduce the number of webhook calls\n* Test and save webhook\n\n* Generate a new API client (or use existing) (see [https://support.awork.com/en/articles/5415664-client-applications-and-api-keys](https://support.awork.com/en/articles/5415664-client-applications-and-api-keys))\n\n* Add new credentials for Awork to your n8n installation (see [https://docs.n8n.io/credentials/add-edit-credentials/](https://docs.n8n.io/credentials/add-edit-credentials/))\n++ Choose \"Header auth\" from the list and name as you like, e.g. \"Awork API Access\"\n++ Set \"name\" to \"Authorization\" and \"value\" to \"Bearer XXX\" with XXX being replaced by the API key created in Awork\n++ Apply credentials to all HTTP Request nodes (blue globe)\n\n\n## Enjoy\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "521684a2-f6d7-483a-aa73-bc6243d6bc33",
      "name": "Webhook call by Awork",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -940,
        0
      ],
      "webhookId": "57b88b94-6228-4e49-897d-64bf8c7d32db",
      "parameters": {
        "path": "57b88b94-6228-4e49-897d-64bf8c7d32db",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "00e9ea34-8110-43a4-a0a3-6d95272b7f22",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -100
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 280,
        "content": "### Workflow config\n* Configure basic settings"
      },
      "typeVersion": 1
    },
    {
      "id": "ae4ad465-18d5-4a8b-b3ea-05aa9b8d81e3",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        -100
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 280,
        "content": "### Extract status changes from webhook call payload\n"
      },
      "typeVersion": 1
    },
    {
      "id": "124b4dc0-cc8b-4b10-89c0-fc3db5aa18bf",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -100
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 280,
        "content": "### Check if task status is currently \"done\"\n* If yes, proceed\n* If no, exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "901b5649-3e43-4b03-9c2a-6281ec14cd3d",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -100
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 280,
        "content": "### Check if dependencies are enabled\n* If yes, process dependencies\n* If no, check if tree structure is enabled"
      },
      "typeVersion": 1
    },
    {
      "id": "72cf9e1b-26f4-4132-b760-1b46f5348948",
      "name": "依存関係有効確認",
      "type": "n8n-nodes-base.if",
      "position": [
        1140,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "53d5f2be-2830-4977-a69f-a0d135ea76c4",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.useDependencies }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1475c9e1-d99b-434c-b1e3-8160d25bd834",
      "name": "全リンクタスクを読み込み",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2260,
        -400
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/me/projecttasks",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "filterby",
              "value": "={{ $json.taskDependencies.join(' or ') }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "waitBetweenTries": 2000
    },
    {
      "id": "4d41c9a6-edae-4a0f-8a06-64c647d4da1a",
      "name": "フィルタパラメータを構築",
      "type": "n8n-nodes-base.code",
      "position": [
        2020,
        -400
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  for( var key in item.json.taskDependencies ) {\n  item.json.taskDependencies[key] = \"id eq guid'\" + item.json.taskDependencies[key] +\"'\";\n}\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "763b71ac-c78b-4020-9fe1-cc80028edfa7",
      "name": "未完了タスクのみフィルタリング",
      "type": "n8n-nodes-base.filter",
      "position": [
        2480,
        -400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8f2bbc21-ad7c-47e2-95b1-f92cb482ea8e",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.taskStatus.type }}",
              "rightValue": "done"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7d90188e-859e-450f-922a-e74c9f69646d",
      "name": "未完了タスクIDを集約",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2700,
        -400
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "id"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1aca54ca-3369-456e-942d-ab929879c2a4",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1560,
        -500
      ],
      "parameters": {
        "color": 4,
        "width": 1320,
        "height": 340,
        "content": "### Load task dependencies and filter open tasks\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d1475f48-a06a-4b67-8374-b1f4c6713eb8",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2980,
        -500
      ],
      "parameters": {
        "color": 3,
        "width": 420,
        "height": 340,
        "content": "### Check if tasks marked as dependencies are open\n* If yes, roll back status.\n* If not, proceed to tree structure check"
      },
      "typeVersion": 1
    },
    {
      "id": "86436ab7-7a4d-47c9-ab9f-9d414205baf3",
      "name": "未完了タスク存在確認",
      "type": "n8n-nodes-base.if",
      "position": [
        3140,
        -400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c30d2bf0-f6ca-46a6-be1e-2f24425fffed",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3c8971c0-9ad5-4265-add8-9dde8baef83a",
      "name": "付箋7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3500,
        -500
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 340,
        "content": "### Roll back task status"
      },
      "typeVersion": 1
    },
    {
      "id": "f5062a59-4067-49f5-9a3a-3087b09a9629",
      "name": "付箋8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3960,
        -500
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 340,
        "content": "### Check if comment should be added to task\n* Exit workflow if no comment should be added"
      },
      "typeVersion": 1
    },
    {
      "id": "6b84e668-7dd8-4ff5-ae98-c2dc6a435c07",
      "name": "コメント機能有効確認",
      "type": "n8n-nodes-base.if",
      "position": [
        4120,
        -400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6505de62-2d0a-4a3a-8f33-f0add4364b7e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.addComments }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "81f39f77-eacb-4882-9a75-5e01dce04e5c",
      "name": "付箋9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4460,
        -500
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 340,
        "content": "### Add comment to task regarding roll back of task state\n* Add comment and exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "cad1126c-4a60-47e2-8b75-0c2b35464497",
      "name": "タスクにコメント追加",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4640,
        -400
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/tasks/{{ $('Webhook call by Awork').item.json.body.entity.id }}/comments",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"message\": {{ JSON.stringify($('Workflow config').item.json.commentTextDependencies) }}\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "CmNSbB7CCq63XJLe",
          "name": "Zammad API - TICKET"
        },
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "a98ba8ae-05d4-4175-beed-fd9f40c772d3",
      "name": "ツリー構造有効確認",
      "type": "n8n-nodes-base.if",
      "position": [
        3600,
        120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "53d5f2be-2830-4977-a69f-a0d135ea76c4",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.useTreeStructure }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3464568d-3863-4063-8097-526b60260818",
      "name": "付箋11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3500,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 340,
        "content": "### Check if tree structure check is enabled\n* Exit workflow if not enabled"
      },
      "typeVersion": 1
    },
    {
      "id": "1e2f8502-fc35-4e6f-bb9a-83acb04d57af",
      "name": "付箋12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3960,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 340,
        "content": "### Check if task has subtasks\n* Exit workflow if no subtasks found"
      },
      "typeVersion": 1
    },
    {
      "id": "d25eeac9-c485-4624-8b9f-b7068a4eb0b5",
      "name": "サブタスク確認",
      "type": "n8n-nodes-base.if",
      "position": [
        4080,
        100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "965e2460-236b-4628-b6e9-e4082b656b0f",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.entity.numberOfSubtasks }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6bcac41a-3f06-4a35-9703-fdfba98d1ac4",
      "name": "タスクステータスを完了から前の状態にロールバック",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3620,
        -400
      ],
      "parameters": {
        "url": "https://api.awork.com/api/v1/tasks/changestatuses",
        "method": "POST",
        "options": {},
        "jsonBody": "=[\n  {\n    \"taskId\": \"{{ $('Webhook call by Awork').item.json.body.entity.id }}\",\n    \"statusId\": \"{{ $('Filter task status change').item.json.old }}\" \n}\n] ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "38782806-11a3-4976-8ba6-17da89d7a859",
      "name": "全未完了サブタスクを読み込み",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4560,
        100
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/me/projecttasks",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "filterby",
              "value": "=parentid eq guid'{{ $('Webhook call by Awork').item.json.body.entity.id }}' and taskstatus/type ne 'done'"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "ad23f9c2-bdb4-48b7-ad6b-776424c0275d",
      "name": "タスクIDを集約",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        4780,
        100
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "id"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "711fd327-892a-48e2-95ea-24a21cba1765",
      "name": "付箋10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4460,
        20
      ],
      "parameters": {
        "color": 4,
        "width": 500,
        "height": 340,
        "content": "### Load subtasks not marked as done"
      },
      "typeVersion": 1
    },
    {
      "id": "fe844b55-800d-426c-9842-ccb8cc0d33f3",
      "name": "付箋14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5060,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 340,
        "content": "### Check if open subtasks exist\n* Exit workflow if no open subtasks found"
      },
      "typeVersion": 1
    },
    {
      "id": "946243b8-ceaa-4ce3-a4d1-97bc3ee9f9ed",
      "name": "未完了サブタスク確認",
      "type": "n8n-nodes-base.if",
      "position": [
        5180,
        100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f1c49c95-5272-4414-99f6-55e146a33ae2",
              "operator": {
                "type": "array",
                "operation": "lengthGt",
                "rightType": "number"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e4e43d31-a7c1-404c-a67a-21236314f46c",
      "name": "付箋15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5580,
        20
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 340,
        "content": "### Roll back task status"
      },
      "typeVersion": 1
    },
    {
      "id": "7065d3b2-f120-4636-b30e-d919d4ca47c8",
      "name": "付箋16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6040,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 340,
        "content": "### Check if comment should be added to task\n* Exit workflow if no comment should be added"
      },
      "typeVersion": 1
    },
    {
      "id": "e4b9348e-de14-425a-b9ed-64891681c49a",
      "name": "コメント機能有効確認1",
      "type": "n8n-nodes-base.if",
      "position": [
        6200,
        120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6505de62-2d0a-4a3a-8f33-f0add4364b7e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.addComments }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e01f0f8a-d844-4f51-8c38-044d1be4c3b3",
      "name": "付箋17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6540,
        20
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 340,
        "content": "### Add comment to task regarding roll back of task state\n* Add comment and exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "65c7656e-f03e-4082-8226-34a052fbdc38",
      "name": "タスクにコメント追加1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6720,
        120
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/tasks/{{ $('Webhook call by Awork').item.json.body.entity.id }}/comments",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"message\": {{ JSON.stringify($('Workflow config').item.json.commentTextTreeStructure) }}\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "CmNSbB7CCq63XJLe",
          "name": "Zammad API - TICKET"
        },
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "0521eaf8-0719-4691-be1d-82a6defa87ca",
      "name": "タスクステータスを完了から前の状態にロールバック1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5700,
        120
      ],
      "parameters": {
        "url": "https://api.awork.com/api/v1/tasks/changestatuses",
        "method": "POST",
        "options": {},
        "jsonBody": "=[\n  {\n    \"taskId\": \"{{ $('Webhook call by Awork').item.json.body.entity.id }}\",\n    \"statusId\": \"{{ $('Filter task status change').item.json.old }}\" \n}\n] ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "9d0FyCu0IlwrdNkM",
          "name": "Awork Api"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "0a266961-2e39-4508-a37e-9a5ec6811466",
      "name": "付箋13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -660
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "content": "## Green sticky notes: Logical group of nodes"
      },
      "typeVersion": 1
    },
    {
      "id": "a2014e67-29c9-49fb-86eb-0e5fe0969455",
      "name": "付箋18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -660
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "content": "## Red sticky notes: Routing and possible workflow exit"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "d25eeac9-c485-4624-8b9f-b7068a4eb0b5": {
      "main": [
        [
          {
            "node": "38782806-11a3-4976-8ba6-17da89d7a859",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b05f8f7-9451-481d-b2cb-b74c4048f9e0": {
      "main": [
        [
          {
            "node": "a610af8c-a4eb-4fa0-987f-8c001f78de20",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ad23f9c2-bdb4-48b7-ad6b-776424c0275d": {
      "main": [
        [
          {
            "node": "946243b8-ceaa-4ce3-a4d1-97bc3ee9f9ed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cc8d6540-122e-48e0-bcf7-91331eea11d4": {
      "main": [
        [
          {
            "node": "72cf9e1b-26f4-4132-b760-1b46f5348948",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a610af8c-a4eb-4fa0-987f-8c001f78de20": {
      "main": [
        [
          {
            "node": "72b495ae-fd9c-4347-ae17-8ba93a3afeb9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4d41c9a6-edae-4a0f-8a06-64c647d4da1a": {
      "main": [
        [
          {
            "node": "1475c9e1-d99b-434c-b1e3-8160d25bd834",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "946243b8-ceaa-4ce3-a4d1-97bc3ee9f9ed": {
      "main": [
        [
          {
            "node": "0521eaf8-0719-4691-be1d-82a6defa87ca",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cad1126c-4a60-47e2-8b75-0c2b35464497": {
      "main": [
        []
      ]
    },
    "1475c9e1-d99b-434c-b1e3-8160d25bd834": {
      "main": [
        [
          {
            "node": "763b71ac-c78b-4020-9fe1-cc80028edfa7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "521684a2-f6d7-483a-aa73-bc6243d6bc33": {
      "main": [
        [
          {
            "node": "1b05f8f7-9451-481d-b2cb-b74c4048f9e0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "763b71ac-c78b-4020-9fe1-cc80028edfa7": {
      "main": [
        [
          {
            "node": "7d90188e-859e-450f-922a-e74c9f69646d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "72b495ae-fd9c-4347-ae17-8ba93a3afeb9": {
      "main": [
        [
          {
            "node": "a4ec9460-d622-4d4b-a31b-ba3705faa88f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7d90188e-859e-450f-922a-e74c9f69646d": {
      "main": [
        [
          {
            "node": "86436ab7-7a4d-47c9-ab9f-9d414205baf3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "38782806-11a3-4976-8ba6-17da89d7a859": {
      "main": [
        [
          {
            "node": "ad23f9c2-bdb4-48b7-ad6b-776424c0275d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "86436ab7-7a4d-47c9-ab9f-9d414205baf3": {
      "main": [
        [
          {
            "node": "6bcac41a-3f06-4a35-9703-fdfba98d1ac4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a98ba8ae-05d4-4175-beed-fd9f40c772d3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a4ec9460-d622-4d4b-a31b-ba3705faa88f": {
      "main": [
        [
          {
            "node": "cc8d6540-122e-48e0-bcf7-91331eea11d4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8743a397-a6ca-4325-b0f8-33a34e15b63a": {
      "main": [
        [
          {
            "node": "d3ac4527-eb09-49f5-9bff-7d83e494022d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3ac4527-eb09-49f5-9bff-7d83e494022d": {
      "main": [
        [
          {
            "node": "4d41c9a6-edae-4a0f-8a06-64c647d4da1a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6b84e668-7dd8-4ff5-ae98-c2dc6a435c07": {
      "main": [
        [
          {
            "node": "cad1126c-4a60-47e2-8b75-0c2b35464497",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "72cf9e1b-26f4-4132-b760-1b46f5348948": {
      "main": [
        [
          {
            "node": "8743a397-a6ca-4325-b0f8-33a34e15b63a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a98ba8ae-05d4-4175-beed-fd9f40c772d3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e4b9348e-de14-425a-b9ed-64891681c49a": {
      "main": [
        [
          {
            "node": "65c7656e-f03e-4082-8226-34a052fbdc38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a98ba8ae-05d4-4175-beed-fd9f40c772d3": {
      "main": [
        [
          {
            "node": "d25eeac9-c485-4624-8b9f-b7068a4eb0b5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6bcac41a-3f06-4a35-9703-fdfba98d1ac4": {
      "main": [
        [
          {
            "node": "6b84e668-7dd8-4ff5-ae98-c2dc6a435c07",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0521eaf8-0719-4691-be1d-82a6defa87ca": {
      "main": [
        [
          {
            "node": "e4b9348e-de14-425a-b9ed-64891681c49a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - IT運用

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数44
カテゴリー1
ノードタイプ9
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34