Rally Software

Expand all | Collapse all

How to Fetch an Object Details using its ObjectID in a Custom App

Jump to Best Answer
  • 1.  How to Fetch an Object Details using its ObjectID in a Custom App

    Posted 09-14-2017 12:29 PM

    I have an app which is fetching data from Lookback API. I get User ObjectID in the data, however I would like to get the DisplayName of the User instead of ObjectID. I tried using store to get the user DisplayName with ObjectID filter, but I don't get the name of the user, until I finish my loop of going through Lookback API data. In SDK 1.x we used to have RallyDataSource.getRallyObject, which we could use to fetch a single object. In SDK 2.0 I couldn't find any such function. Any other way to accomplish this in SDK 2.0?



  • 2.  Re: How to Fetch an Object Details using its ObjectID in a Custom App
    Best Answer

    Posted 09-22-2017 04:28 AM

    LJoshi,

     

    You should be able to get the DisplayName in a Store using the ObjectID from the lookback API like this:

     

    Ext.create('Rally.data.wsapi.Store', {
    model: 'user',
    autoLoad: true,
    listeners: {
    load: this._onDataLoaded,
    scope: this
    },
    filters: [{property:'ObjectID',operator:'=',value:<UserObjectID>}],
    fetch: ['UserName', 'DisplayName'],
    limit: Infinity,
    sorters: [{property: 'UserName',direction: 'ASC'}]
    });

     

    There is also an example with a different workflow which uses Lookback API to fetch the first revision of an Artifact then uses the ObjectID from the Lookback API data to get the UserName available here:

     

    GitHub - markwilliams970/Artifacts-ByCreator-Lookback 

     

    I hope that helps.

     

    Michael



  • 3.  Re: How to Fetch an Object Details using its ObjectID in a Custom App

    Posted 09-22-2017 12:30 PM

    Hello Michael,

     

    Thank you for your response. I am using the store to get the User Details based on ObjectID. However, as I am calling the store function while looping thorough the Lookback data, the store state is pending until the loop is complete. Hence I do not get User Name until I have finished processing the data. After processing, loading the store is of no use.

    Another way I tried was to get the User Model loaded than fetch the user name from that model. That works well for all active users. However, if a user has been disabled, I cannot get him in the User Model. I was thinking of getting those users using ObjectID while going through the Lookback Data in loop. I can get Disabled user using direct JSON URI - https://rally1.rallydev.com/slm/webservice/v2.0/user?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/<WSID>&query=(ObjectID%20%3D%<userObjectID>)&fetch=true&start=1&pagesize=1

    But not able to get same in the App.

     

    Thanks,

    Lokesh