Brief summary of this article:
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
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 Capacity: avgVelocity\n }\n }\n};\n\n" } ]
Add description and save the rule
Still have a question?
We're here to help! Just contact our friendly support team.