It's all about the answers!

Ask a question

Required Attributes For Condition is not working properly


Snehal Yendhe (15130) | asked Feb 13 '18, 2:41 p.m.
edited Feb 13 '18, 2:48 p.m.

Hello All,


In my demo project i have added new attribute named as 'RootCauseAnalysis'. My task is to make this field as mandatory when user selects severity as Critical. so to do this i have set "Require attributes for condition" precondition for this newly added attribute.

I can see Asterisk sign on "RootCauseAnalysis" field but, even if i keep this field empty, application accepts empty string and saves the work item. I think it should show "Attribute 'RootCauseAnalisis' is not set" error.

I have used below script for same: (CLM 6.0.3)

dojo.provide("com.example.Condition");

(function() {
    dojo.declare("com.example.Condition", null, {

        matches: function(workItem, configuration) {
           
        var workitem = com.ibm.team.workitem.api.common.WorkItemAttributes; 
        var severity = workItem.getValue(workitem.SEVERITY); 
        if(severity == "severity.literal.l5")
        {
           return true; 
        }
        else 
        {
           return false;
        }
        }
    });
})();

Please let me know what i am missing while setting precondition.I referred below link:

Accepted answer


permanent link
Don Yang (7.7k21109138) | answered Feb 13 '18, 6:50 p.m.

I have tried 'Required Attributes For Condition' recently with 6.0.2 and 6.0.4 and both works fine.
I notice that your script does not have
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(under dojo.provide("com.example.Condition");)
I did not test the script without the above line so I don't know the impact of lacking it.

"I can see Asterisk sign on "RootCauseAnalysis" field ": do you see Asterisk sign on both web and Eclipse client?
or it is only in Web client but Eclipse shows no ' Asterisk sign'?

In general, there are two things I would suggest to check with:

1) https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Configuring_a_script_based_custo
check 'Enable Process Attachment Scripts property ' is set to true

2) In Eclipse client, open the project and go to Link tab > Attachment, check if you see any 0 byte .js file.
If yes, delete it and try to test again.

Snehal Yendhe selected this answer as the correct answer

Comments
Snehal Yendhe commented Feb 14 '18, 6:50 a.m.

 Hi Don,


 Thanks for this information. I have added the 

[dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); ] in my code and now its working properly. 

One other answer



permanent link
Ralph Schoon (63.1k33646) | answered Feb 14 '18, 2:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

In addition to Don's comment, I see over and over again that it is not clear how operational behavior works and it is frequently configured wrong and not called when the user expects it to be.

Carefully read

  and Process permissions lookup in Rational Team Concert 2.0 and be aware of the differences of permission and operational behavior.

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.