Calculate Capacity of Team Iteration automatically based on previous Velocities | Targetprocess - Visual management software

Calculate Capacity of Team Iteration automatically based on previous Velocities

Planning capacity for future Team Iteration based on previous periods is quite a typical case among our customers. Scrum Masters, Managers, or Team Leads normally calculate each team’s average points completed per Team Iteration over the last N months and use that average as a starting point for the next time-boxes. There is no more need to calculate capacity externally. The following article will help to automate this process using Targetprocess Automation Rules functionality.

Use Case

AS a Scrum Master
WHEN I create a new Team Iteration card, average Velocity from last 5 Team Iteration is calculated and set to "Capacity" field of new Team Iteration automatically. If some Team Iteration has 0, it is not taken into account and does not influence the calculation.
SO THAT I do not need to make it manually.

Solution

  • Navigate to Settings -> Automation rules -> Raw Json View
    Automation Rules

  • Copy and paste the following piece of code:

    [ 
         {
        "type": "source:targetprocess:EntityChanged",
        "entityTypes": [
          "TeamIteration"
        ],
        "modifications": {
          "created": true,
          "deleted": false,
          "updated": false
        }
      },
      {
        "type": "action:JavaScript",
        "script": "const teamId = args.Changed.Team.Id;\n\nconst api = context.getService(\"targetprocess/api/v2\");\nconst querySpec = {\n  select: \"{velocity}\",\n  take: 5,\n  where: \"velocity > 0 and team.id =\" + teamId\n};\n\nconst teamiterations = await api.queryAsync(\"TeamIteration\", querySpec);\n\nconst avgVelocity = teamiterations.reduce((acc, value) => acc + value.velocity, 0) / teamiterations.length;\n\nreturn {\n  command: \"targetprocess:UpdateResource\",\n  payload: {\n    resourceType: \"TeamIteration\",\n    resourceId: args.ResourceId,\n    fields: {\n      Velocity: avgVelocity\n    }\n  }\n};\n\n"
      }
    ]

  • Add description and save the rule
    Automate average Velocity

Still have a question?

We're here to help! Just contact our friendly support team

Find out more about our APIs, Plugins, Mashups and custom extensions. Join our community of passionate users and even discuss directly with our developers.

Get Started for free

Enter your email
By clicking "Continue", you acknowledge that we will process your Personal Data in accordance with our Service Privacy Policy and Terms of Service, and agree to the aforementioned documents.

We’ve sent you a confirmation e-mail — please, go check it.

Or get a live
product demo