Search code examples
javascriptextjsrallylookbackapi

Rally LookBack API with Release filter not working


Rally LookBack API with Release filter not working

Hello Friends, I need to add "Release filter" to the Defect Trends report at "https://github.com/RallyCommunity/DefectTrendApp/blob/master/deploy/App.html"

However due to some stranage reason. it does not fetches any results. I cant find anything release related to filter in the documentation as well.

It would be great, if any one will let me know if this is not supported or I am missing something.

I tried adding filters such as

releaseFilters = Ext.create('Rally.data.lookback.QueryFilter', {
                        property: 'Defect.Release.Name',
                          operator: '=',
                        value: '4.11'
                    }); 

Tried using the ObjectID as well. However no success.

Please help.


Solution

  • This should work:

     releaseFilter = Ext.create('Rally.data.lookback.QueryFilter', {
            property: 'Release',
            operator: '=',
            value: 16995672374
          });
          return projectFilter.and(typeFilter.and(stateFilters)).and(releaseFilter);
    

    Please make sure not to use quotes around the ObjectID. Also, Release.Name will not work since LBAPI does not access Release or Iteration Name.

    Here is a full js file where I use $in operator to filter in items from multiple releases:

    Ext.define('CustomApp', {
        extend: 'Rally.app.App',
        componentCls: 'app',
        launch: function() {
        var releaseFilter = Ext.create('Rally.data.lookback.QueryFilter', {
            property: 'Release',
            operator: '$in',
            value: [16995672374,15679194578,14299783630]
          });
            Ext.create('Rally.data.lookback.SnapshotStore', {
                    fetch    : ['_UnformattedID', 'Name','Release'],
            filters  : [releaseFilter],
                    listeners: {
                        load: this._onDataLoaded,
                        scope: this
                    }
                    }).load({
                        params : {
                            compress : true,
                            removeUnauthorizedSnapshots : true
                        }
                    });          
        },
         _onDataLoaded: function(store, data){
                    var workItems = store.getRange();
                    _.each(workItems, function(item){                                  
                        console.log(item.get('_UnformattedID') + ' ' + item.get('Name') + ' ' + item.get('Release'))
                    });
         }
    });