It's all about the answers!

Ask a question

"Read-Only Attributes for Condition" and Javascript Conditions


Stefan Oblinger (185213) | asked Dec 10 '15, 10:45 a.m.
The Operation Behavior Precondition "Read-Only Attributes for Condition" in combination with Javascript Conditions shows unexpected behavior. If dedicated conditions for different roles are configured, wrong Conditions get executed! I can reproduce the failure with any web browser, while the Eclipse client works fine.

I executed following test with RTC versions 6.0/5.0.2 (local installation with Tomcat AS) and Webbrosers Firefox/IE/Chrome in a project area based on the default Scrum template:

1. Created two Javascript Conditions (Project Configuration -> Configuration Data -> Work Items -> Attribute Customizations -> Conditions):

Developer Condition
dojo.provide("com.example.DeveloperCondition");
(function() {
    dojo.declare("com.example.DeveloperCondition", null, {
        matches: function(workItem, configuration) {
            console.log("Developer Condition");
            return false;
        }
    });
})();

Everyone Condition
dojo.provide("com.example.EveryoneCondition");
(function() {
    dojo.declare("com.example.EveryoneCondition", null, {
        matches: function(workItem, configuration) {
            console.log("Everyone Condition");
            return true;
        }
    });
})();

2. Added Operation Behavior Precondition "Read-Only Attributes for Condition" to role Everyone, added Condition "Everyone Condition" and checked Attribute "Summary".

3. Added Operation Behavior Precondition "Read-Only Attributes for Condition" to role Developer, added Condition "Developer Condition" and checked Attribute "Summary".

4. Added a new user with role Developer to project area.

5. Logged on and tried to create a Task work item. The Everyone Condition is executed and Summary is read-only. Console log shows "Everyone Condition". But in fact the user has role Developer, otherwise he would not be able to save the Task work item.

6. After server reboot and logon the Developer Condition was executed during task creation. But then i revoked Developer role from user, still Developer Condition is executed during task creation until the server is rebooted.

So there seems to be some caching issue with the server. My web proxy was turned off. As mentioned before, only Web Browsers are affected, the Eclipse Client works fine.

Has anyone encountered this error before or knows about it's cause?

2 answers



permanent link
Ralph Schoon (63.1k33646) | answered Dec 10 '15, 11:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 10 '15, 11:58 a.m.
I read the question again and again and I will rephrase my answer.

I have seen issues with this while developing these conditions. I would like to suggest to use Ctrl-F5 or clearing the browser caches.

There is a another issue, in case you configure the conditions for every role. Only the first role that is found is actually computed. See: Process behavior lookup in Rational Team Concert 2.0 how that is done. Roles a user has, also depend on the context that owns the item. The order of the roles is also important, everyone is always the last role, however.

So your attempt is valid. But please be aware, you can not access the role of a user in JavaScript. You basically have no access to it. So the conditions above will have to be configured as you did and you don't know about the user role in the actual condition.

If you want to avoid the effort to configure that (and every other behavior you want for everyone) for all roles, you would take another approach.

1. Use a JavaScript based condition like A Custom Condition to Make Attributes Required or Read-Only by Role Version 2 where you can test for the role of the user in the condition. This way you only need to configure this for "Everyone" or if you configure different behavior for other roles.
2. Go the path Sam did and create a pre-condition. This way you only need to configure this for "Everyone" or if you configure different behavior for other roles.

permanent link
Stefan Oblinger (185213) | answered Feb 22 '16, 11:18 a.m.
Rational Client Support was able to reproduce the issue and confirmed it as a bug: Defect 384588

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.