It's all about the answers!

Ask a question

RTC Required attributes for Type and Condition


Matt Muller (59813574) | asked Jul 10 '15, 9:20 a.m.

Good Afternoon,

I'm trying to apply a Required Attributes condition based on a script;  in Version 4.0.7

Using an Enumeration and a Medum HTML Attributes

I have created a Conditions Script (below);

and also added in the Operational Behavious.

Is this correct - I'm been looking at this for some time but can't seem to get it to work? any suggestions would help.

dojo.provide("org.example.workitems.providers.ragComment");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");


(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

 
dojo.declare("org.example.workitems.providers.ragComment", null, {

 matches: function(workItem, configuration) {
 var rag= workItem.getValue("com.nbs.workitem.attribute.ragstatus");
 return (rag ==="com.nbs.workitem.enumeration.ragstatus.literal.l5");


   }
});
})();

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jul 14 '15, 6:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This script works for me:

/*******************************************************************************
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2011. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:  
 * Use, duplication or disclosure restricted by GSA ADP Schedule 
 * Contract with IBM Corp. 
 *******************************************************************************/
dojo.provide("com.example.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes; 
    dojo.declare("com.example.Condition", null, {
        matches: function(workItem, configuration) {
        
            var prio = workItem.getValue(WorkItemAttributes.PRIORITY);
            if(prio=="priority.literal.l11"){
            	return true;
            }
            return false;
        }

    });
})();
Matt Muller selected this answer as the correct answer

Comments
Matt Muller commented Jul 14 '15, 6:49 a.m.

Thanks for the fast response Ralph;

I made a slight change: if(prio=="priority.literal.l2"){  as I11 is not valid

That did not work for me.


Ralph Schoon commented Jul 14 '15, 6:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I assume you have configured the operation behavior.
Since I can't look at your system and there is no data available, this is what can be done in the forums. Maybe there is an issues with your process template. Only support can help then.


Matt Muller commented Jul 14 '15, 7:20 a.m.

Yes it's all configured for the operation behaviour.

It's all very confusing and frustrating.

I appreciate your help Ralph.

Thank you


Ralph Schoon commented Jul 14 '15, 7:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Another suggestion: set up a small test system to experiment with this stuff, that way you have more control and access to logs etc. I always run this on simple set ups with Tomcat and Derby based on the JKE example. You can create a test project with your template as well.


Matt Muller commented Jul 14 '15, 8:26 a.m.

I've rasied a Jazz defect - let's see what happens there..


Matt Muller commented Jul 14 '15, 11:05 a.m.

Quick Update -  I've applied the "Required Attributes For Type and State;  and this is not working in the Process template...


Ralph Schoon commented Jul 14 '15, 11:31 a.m. | edited Jul 14 '15, 11:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You want the "Required Attributes For Condition" or "Read-Only Attributes For Condition" to be configured with your condition and not the "** Attributes For Type and State". That does NOT work on a condition





Ralph Schoon commented Jul 14 '15, 11:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Have you considered to delete the browser cache? Restart the server?
The  "** Attributes For Type and State" work in a similar way to the required by condition. Maybe the process XML is broken? What if you open the process configuration source? Do you see errors?


Matt Muller commented Jul 15 '15, 3:29 a.m.

Ralph,

Ok...  so as part of my development work I was looking at some restrictions applied with Operation Behavior at the Iteration Level...

I only switched on the Preconditions and follow-up actions for a sub Iteration and this stopped all of the "Operation Behaviors" working at the Team Level.

Took the tick out of the box..  all working and the script you sent over is working...  So after all of that - it was my error;

thank you for all of you help and the questions etc.

I learnt something new - again today with RTC...  you never stop learning!


Ralph Schoon commented Jul 15 '15, 3:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Yes, that can be tricky. See Process behavior lookup in Rational Team Concert 2.0 for some heads up.

Glad it is working for you now.

Please accept the correct answer. Thanks and good luck.

showing 5 of 10 show 5 more comments

2 other answers



permanent link
Ralph Schoon (63.1k33646) | answered Jul 10 '15, 9:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Have you considered debugging the script as explained in the Process Enactment Workshop or the library article about debugging JavaScript?

Comments
Matt Muller commented Jul 10 '15, 9:27 a.m.

I have tried to debugging using the console log - but it doesn't seem to call the script?

I have other scripts working..


Ralph Schoon commented Jul 10 '15, 10:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

There is no console.log() statement. Oh, and because it is a condition it might be tough to debug in a browser. The log will be somewhere else, I think, because it is a condition. I think the Process Enactment workshop mentions that.

1. Try to return true  - just that - try if it does anything.
2. Make it a real if/then 


Matt Muller commented Jul 13 '15, 10:05 a.m.

Hi Ralph,

I've tried to fix this agian today;  and based on an Enumeration I can't get it working.  As I'm on 4.0.7 i'm thinking it maybe due to the version of IE?  I'm using IE.11 so maybe its an issue there?  I'm going to try to get Google or Firefox installed to check it.

So in summary I can get Dynamic attributes working on another project area using "Integar" attributes.  Emumerations.. just can't seem to get it working?


Ralph Schoon commented Jul 13 '15, 10:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This works with enumerations as well. You can try to use == instead of ===, you can try to use other string comparison capabilities. You can try to console.log() your data. In general this should work. See

  for more information.

I don't know if the browser could be an issue.  


Matt Muller commented Jul 14 '15, 6:07 a.m.

Hi I've looked on all the instructions etc. and I can't figure this one out?

Tried Firefox.. still not working.

Any known defects in 4.0.7

https://jazz.net/library/article/1003/#conditions

I think it maybe the custom attributes I've setup?

Maybe I need to raise a defect?

1. Enumeration Id is: com.nbs.workitem.enumeration.ragstatus

2. Attribute ID is: com.nbs.workitem.attribute.ragstatus


permanent link
Matt Muller (59813574) | answered Jul 15 '15, 3:30 a.m.
All fixed - Removed Operation Behaviors at the Iteration Level

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.