有没有办法批量创建故事并将它们分配给迭代?

时间:2013-11-01 23:39:20

标签: rally

我们每个月都这样做,并希望将故事的创建和日程安排自动化到未来的迭代中。

2 个答案:

答案 0 :(得分:0)

我们之前研究了几个冲刺。我相信您需要将故事导出到csv(在迭代中的“Actions”下)并将它们导入到新的迭代中。

答案 1 :(得分:0)

这是一个AppSDK2示例,它创建一个故事并将其安排到从迭代组合框中选择的迭代。

<!DOCTYPE html>
<html>
<head>
    <title>Create Story</title>

    <script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>

    <script type="text/javascript">
        Rally.onReady(function () {
            Ext.define('CustomApp', {
                extend: 'Rally.app.TimeboxScopedApp',
                componentCls: 'app',
                scopeType: 'iteration',
                comboboxConfig: {
                    fieldLabel: 'Select an Iteration:',
                    labelWidth: 100,
                    width: 300
                },

                addContent: function() {   
                    this._getIteration();
                },

                onScopeChange: function() {
                    this._getIteration();
                },


                _getIteration: function() {
                        var iteration = this.getContext().getTimeboxScope().record.get('_ref');
                        console.log('iteration',iteration);

                        if (!this.down('#b2')) {
                             var that = this;
                             var cb = Ext.create('Ext.Container', {

                            items: [
                                {
                                    xtype  : 'rallybutton',
                                    text      : 'create',
                                    id: 'b2',
                                    handler: function() {
                                        that._getModel(iteration); 
                                    }
                                }

                                ]
                            });
                        this.add(cb);
                        }
                    },


                _getModel: function(iteration){
                        var that = this;
                        Rally.data.ModelFactory.getModel({
                            type: 'UserStory',
                            context: {
                                workspace: '/workspace/1111' 
                            },
                            success: function(model) {  //success on model retrieved
                                that._model = model;
                                var story = Ext.create(model, {
                                    Name: 'story 777',
                                    Description: 'created via appsdk2'
                                });
                                story.save({
                                    callback: function(result, operation) {
                                        if(operation.wasSuccessful()) {
                                            console.log("_ref",result.get('_ref'), ' ', result.get('Name'));
                                            that._record = result;
                                            that._readAndUpdate(iteration);
                                        }
                                        else{
                                            console.log("?");
                                        }
                                    }
                                });
                            }
                        });
                    },

                    _readAndUpdate:function(iteration){
                        var id = this._record.get('ObjectID');
                        console.log('OID', id);
                        this._model.load(id,{
                            fetch: ['Name', 'FormattedID', 'ScheduleState', 'Iteration'],
                            callback: function(record, operation){
                                console.log('ScheduleState prior to update:', record.get('ScheduleState'));
                                console.log('Iteration prior to update:', record.get('Iteration'));
                                record.set('ScheduleState','In-Progress');
                                record.set('Iteration', iteration);
                                record.save({
                                    callback: function(record, operation) {
                                        if(operation.wasSuccessful()) {
                                            console.log('ScheduleState after update:', record.get('ScheduleState'));
                                            console.log('Iteration after update:', record.get('Iteration'));
                                        }
                                        else{
                                            console.log("?");
                                        }
                                    }
                                });
                            }
                        })
                    }


            });

                        Rally.launchApp('CustomApp', {
                            name:"Create Story"
                            //parentRepos:""
                        });

                    });
                </script>

                <style type="text/css">
            .app {
                 /* Add app styles here */
            }
                </style>
            </head>
            <body></body>
            </html>