1

I'm new to Rally's SDK. I'm trying to create a Kanban board that only shows the cards where the owner field = the person who's logged in (i.e. a My Kanban Board). What code should I add and where should I add it?

The following isn't my ideal answer to this issue, but I'd thought I'd post in case it helps someone else. I took the code from the Filter Epic post as suggested and modified it. It's not ideal for me because the filter occurs after the initial data pull, so it is only filtering the first 100 records the initial query pulled. Ideally, I want to change the initial pull of data to filter on username.

After this code in the Filtering Epic:

for (i=0;i<workproducts.length;i++) {
    thisWorkProduct = workproducts[i]; 

Add:

//get the owner field value

var owner = "";

if (thisWorkProduct.Owner) {
   if (thisWorkProduct.Owner.DisplayName) {
        owner = thisWorkProduct.Owner.DisplayName;
   }
   else if (thisWorkProduct.Owner.UserName) {
    owner = thisWorkProduct.Owner.UserName;
   }
}

And then change:

if (thisWorkProduct.Children.length === 0) {

To:

if ((thisWorkProduct.Children.length === 0) && (owner === "__USER_NAME__")) {

And add in an if in the defects else (so it will now look like this):

else {

   // If it's a Defect, it has no children so push it
   if (owner === "__USER_NAME__") {
      childlessWorkProducts.push(thisWorkProduct);
 }

It's probably not the most efficient code because I'm new to javascript.

And if anyone has suggestions on how to do the username filter in the initial data pull, I'd love to hear them.

Community
  • 1
  • 1

2 Answers2

0

Check out this answer:

Filtering epics from Kanban board

It would be pretty straightforward to adapt the filtering callback to filter by Owner instead of just child-less artifacts.

Community
  • 1
  • 1
  • That could work, but I want it to include it in the data pull, not in card rendering. I think it needs to be added to the onLoad function, but I'm not sure how to add it. – user1821040 Nov 14 '12 at 00:03
0

You can filter on the initial data pull by including a query in the cardboardConfig object:

var cardboardConfig = {
    //... other properties
    query: new rally.sdk.util.Query('Owner = /user/__USER_OID__')
};
Kyle Morse
  • 8,390
  • 2
  • 15
  • 16
  • The only other thing that was needed to make the code fully function was a change was after "if (hideLastColumnIfReleased && releaseTypeAvailable) {". I had to change the next line to: "cardboardConfig.query = new rally.sdk.util.Query.or([("Release = null"),(kanbanField + " != " + '"' + lastState + '"')]) .and('Owner = /user/__USER_OID__');". Otherwise, the existing line would have overwritten the query to pull only the current user's work. – user1821040 Nov 14 '12 at 21:34