Rally自定义字段配置咨询:父子用户故事关联与日期设置
Alright, let’s break down how to set up these custom fields in Rally based on your requirements. I’ve worked through similar configurations before, so here’s a practical, step-by-step breakdown for each part:
Rally doesn’t have a native out-of-the-box way to auto-calculate parent story completion from children, but we can build this with a custom app or webhook. Here’s how:
Step 1: Create the Custom Field
First, add the field itself to User Stories:
- Navigate to Setup > Workspaces & Projects, select your target workspace/project.
- Go to Custom Fields and click Add New Field.
- Choose Decimal or Percent (if your Rally instance supports it) as the field type, name it
completion %, and assign it to the User Story work item type. - Set basic permissions (e.g., who can edit/view the field) based on your team’s needs.
Step 2: Auto-Calculate Parent Completion
You have two reliable options to automate the calculation:
Option A: Custom Rally App (Scheduled or On-Demand)
Build a lightweight app using the Rally App SDK that fetches child stories, aggregates their completion rates, and updates the parent. Here’s a simplified logic snippet to illustrate:
// Initialize Rally API connection Rally.data.ApiFactory.getApi({ success: function(api) { // Query all parent user stories (those with children) api.query({ type: 'UserStory', fetch: ['FormattedID', 'Children', 'completion %'], query: '(HasChildren = true)' }).then(function(parentResults) { parentResults.forEach(function(parentStory) { // Fetch all child stories for the parent api.query({ type: 'UserStory', fetch: ['completion %', 'StoryPoints'], query: '(Parent.FormattedID = "' + parentStory.FormattedID + '")' }).then(function(childResults) { let totalCompletion = 0; let totalStoryPoints = 0; // Calculate weighted average (adjust to simple average if needed) childResults.forEach(function(child) { const points = child.StoryPoints || 1; // Fallback to 1 if no points totalCompletion += (child['completion %'] || 0) * points; totalStoryPoints += points; }); const parentCompletion = totalStoryPoints > 0 ? (totalCompletion / totalStoryPoints).toFixed(2) : 0; // Update the parent story's completion % api.update({ type: 'UserStory', objectId: parentStory.ObjectID, data: { 'completion %': parentCompletion } }); }); }); }); } });
- Deploy this app to your Rally instance (either as a private app or via the App Catalog) and schedule it to run periodically (e.g., hourly) or let users trigger it manually.
Option B: Webhook + External Script
For real-time updates (triggered when a child story’s completion % changes), use Rally webhooks:
- In Setup > Webhooks, create a new webhook that triggers on
UserStoryupdate events, filtering for changes to thecompletion %field. - Point the webhook to an external script (Python, Node.js, etc.) that:
- Receives the updated child story data.
- Fetches its parent story.
- Recalculates the parent’s completion % using all its children.
- Pushes the new value back to the parent story via the Rally API.
This is straightforward since we don’t need any child dependency:
- Go back to Custom Fields in your workspace/project setup.
- Click Add New Field, select Date as the type, name it
Start Date, and assign it to User Story. - Repeat the process to create the
End Datefield. - Critical Note: Rally won’t link these fields to child stories by default—just make sure you don’t configure any workflow rules or calculated dependencies that would tie parent dates to children.
- Optional: Set field permissions (e.g., restrict parent story date edits to project leads) via the Field Permissions tab when editing each field.
Quick Tips for Both Configurations
- Test everything in a non-production project first to avoid messing with live data.
- For the
completion %field, clarify with your team whether you want a simple average, weighted average (by story points), or another aggregation method—adjust the logic accordingly. - If you’re not comfortable coding, check if your Rally instance has any third-party integrations or marketplace apps that handle parent-child completion tracking.
内容的提问来源于stack exchange,提问作者Learn Hadoop

