rallyappsdk2

When using the Custom HTML app, is it possible to display custom portfolio fields in a rally grid?


My goal is to display some custom porfolio fields (the field is called executive champion) in a custon HTML app using a rally grid on the dashboard. I have reviewed the docs and some examples and it does not look like this is possible. Has anyone accomplished this and how? My code is as follows. I used the following to get started https://github.com/davidpthomas/BasicRallyGrid.

<!DOCTYPE html>
<html>
<head>
    <title>BasicRallyGrid</title>

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

    <script type="text/javascript">
        Rally.onReady(function () {
                // Custom Rally App that displays Stories in a grid.
//
// Note: various console debugging messages intentionally kept in the code for learning purposes

Ext.define('CustomApp', {
    extend: 'Rally.app.App',      // The parent class manages the app 'lifecycle' and calls launch() when ready
    componentCls: 'app',          // CSS styles found in app.css

    // Entry Point to App
    launch: function() {

      console.log('our first app');     // see console api: https://developers.google.com/chrome-developer-tools/docs/console-api
      this._loadData();                 // we need to prefix with 'this.' so we call a method found at the app level.
    },

    // Get data from Rally
    _loadData: function() {

      var myStore = Ext.create('Rally.data.wsapi.Store', {
          model: 'PortfolioItem',
          autoLoad: true,                         // <----- Don't forget to set this to true! heh
          listeners: {
              load: function(myStore, myData, success) {
                  console.log('got data!', myStore, myData);
                  this._loadGrid(myStore);      // if we did NOT pass scope:this below, this line would be incorrectly trying to call _createGrid() on the store which does not exist.
              },
              scope: this                         // This tells the wsapi data store to forward pass along the app-level context into ALL listener functions
          },
          fetch: ['Executive Champion', 'Name', 'ScheduleState']   // Look in the WSAPI docs online to see all fields available!
        });

    },

    // Create and Show a Grid of given stories
    _loadGrid: function(myStoryStore) {

      var myGrid = Ext.create('Rally.ui.grid.Grid', {
        store: myStoryStore,
        columnCfgs: [         
          'Executive Champion', 'Name', 'ScheduleState'
        ]
      });

      this.add(myGrid);       

      console.log('what is this?', this);

    }

});


            Rally.launchApp('CustomApp', {
                name:"BasicRallyGrid",
                parentRepos:""
            });

        });
    </script>


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

    </style>
</head>
<body></body>
</html>

Solution

  • It is certainly possible to display PI custom field values in a grid. Even if your custom field has a space in the DisplayName, remove the space from 'Executive Champion' in your code.

    Here is an example. I have a custom field on portfolio item object that is shown in the Setup>Workspaces & Projects as follows:

    Name: PiCustom

    DisplayName: PiCustom

    Workspace admin rights are required to see that page.

    WS API references this field as c_PiCustom (with c_ prepended automatically to indicate a custom field)

    In my code either one works fine: PiCustom, c_PiCustom

    If a workspace admin changes this custom field's DisplayName to include a space as follows:

    Name: PiCustom

    DisplayName: Pi Custom

    It will still be displayed as c_PiCustom in WS API

    and either one of those two ways to reference this field in my code will still work: PiCustom,c_PiCustom

    but Pi Custom will not work.

    Remove the space in your code. Or check exact spelling of that field in the WS API and follow that convention.

    Here is a full example using 2.0rc3:

    Ext.define('CustomApp', {
        extend: 'Rally.app.App',
        componentCls: 'app',
        launch: function() {
                    this.add({
                        xtype: 'rallygrid',
                        model: 'PortfolioItem/Feature',
                        enableRanking: true,
                        storeConfig: {
                          context: {
                              context: this.getContext().getDataContext()
                          }
                        },
                       {
                            dataIndex: 'FormattedID'
                        },{
                            dataIndex: 'Name',
                        },
                         {
                            dataIndex: 'PiCustom'
                        }
                        ]
                    });
        }
    });