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.


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

  • Copy and paste the following piece of code:

        "type": "source:targetprocess:EntityChanged",
        "entityTypes": [
        "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 =\" + 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      Capacity: 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

Email us
The more details you can give us the better
Live chat
Prefer instant messaging? Try our live chat
Service Desk
Add tickets, comments and track status in our Helpdesk
Slack Community
Shape the future direction of Targetprocess

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

Start your free trial

Enter your email
By clicking "Continue", you acknowledge and agree that we will process your personal data in accordance with our Service Privacy Policy and Terms of Service.

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

Or get a live
product demo