Question

I'm trying to get the tags associated with a defect using the lookback api. It seems no matter what I try, I can never get the tags to hydrate. Any Ideas?

I get the following data on return of the query:

ScheduleState: "Backlog"
Tags: Array[1]
   0: 3230012667
   length: 1
   __proto__: Array[0]

My query code is:

Ext.create('Rally.data.lookback.SnapshotStore', {
        fetch: ['Name','ScheduleState', 'Project', 'Tags'],
        autoLoad: true,
        listeners: {
            load: function(store, records) {
                console.log(store);
            }
        },
        hydrate: ['Tags'],
        fields: ['Name','ScheduleState', 'Project', 'Tags'],
        filters: [
            {
                property: '_TypeHierarchy',
                operator: '=',
                value: 'Defect'
            },
            {
                property: 'ScheduleState',
                operator: '!=',
                value: 'Accepted'
            },
            {
                property: '__At',
                value: dateString
            }
        ]
    });
Was it helpful?

Solution

I don't believe you can hydrate tags with the LBAPI. What I would do instead is use the WSAPI create a hash map which maps the tags Object ID to its name. Here's some code to get that done:

Ext.create('Rally.data.WsapiDataStore', {
    limit : Infinity,
    model : 'Tag',
    fetch : ['ObjectID','Name']
}).load({
    callback: function(store) {
        var tagNameMap = Ext.create('Ext.util.HashMap');
        Ext.Array.each(store.getRecords(), function(record) {
            tagNameMap.add(record.get('ObjectID'), record.get('Name'));
        });
        getDefects(tagNameMap); //Pass the tag name map to the LBAPI request
    }
});

Now just use tagNameMap.get(tagOID) to get the name of the tag.

Hope this helps :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top