Rally Software

  • 1.  Retrieving Revisions from Revision History

    Posted Jun 19, 2018 09:22 AM

    Hi,

     

    I am trying to retrieve revisions on an user story. For some reason, it does not provide the revision data. Please see screenshots and code snippets below. 

     

    Ext.create('Rally.data.wsapi.artifact.Store', {
    models: ['UserStory'],
    autoLoad: true,
    limit: Infinity,
    context: {
    project: null
    },
    projectScopeUp: true,
    projectScopeDown: true,
    listeners: {
    scope: this,
    load: function (store, userstories, success) {
    console.log('_getUserStories');
    console.log(userstories);

    // Rally Revision History
    Ext.Array.each(userstories, function (story) {
    Ext.Array.each(story.get('RevisionHistory').Revisions, function (rev) {
    console.log('Revisions');
    console.log(rev);
    });
    });
    deffered.resolve([features, userstories]);
    }


    },
    filters: featurefilter,
    fetch: ['Project', 'ObjectID', 'Owner', 'Owner.Role', 'Role', 'RevisionHistory', 'Revisions', 'RevisionNumber', 'CreationDate', 'User']
    });

     

    Output:

     

     

    Revision History details



  • 2.  Re: Retrieving Revisions from Revision History

    Posted Jun 20, 2018 06:04 AM

    Vijay,

     

    I think you will need to call the Revisions Object via the ref that is provided.  I'm not a Javascript developer, but there is an example here that, will hopefully help:

     

    GitHub - nmusaelian-rally/revisions 

     

    Will also see if morky01 or corkr03 have any thoughts on this question.

     

    Michael



  • 3.  Re: Retrieving Revisions from Revision History

    Broadcom Employee
    Posted Jun 20, 2018 12:57 PM

    Hi Vijayakumar,

     

    Michael is correct and the example he provided you is good. Specifically, check out the app.js in that example, lines 25-38) and look into the implementation of each of these methods.

     

    artifacts.load().then({
    success: this._getRevHistoryModel,
    scope: this
    }).then({
    success: this._onRevHistoryModelCreated,
    scope: this
    }).then({
    success: this._onModelLoaded,
    scope: this
    }).then({
    success: this._stitchDataTogether,
    scope: this
    }).then({

     

    You shall see that the Revisions are not auto-included with the User Stories. You actually need to make a call to the RevisionHistory model and load/include/fetch the Revision information you need. See lines 66-67 in that app.js file:

     

    var revisions = history.get('Revisions');
    revisions.store = history.getCollection('Revisions',{fetch:['User','Description','CreationDate', 'RevisionNumber']});

     

     

    Sagi