Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RTC Attribute Customization : Script based Condition not mandating the enumeration field.

Hello All,

I need to have a script based condition where the Priority should become mandate when the severity is "Critical and blocker".

I am able to get the asterisk mark for the priority, when i select the severity as Critical, But when i save the workitem am not getting any error messages saying "Attribute "Priority" not set".

Why conditions are not working for enum values ?

Following is the code :


dojo.provide("example.Condition");

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

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

Also i have configured this script in pre-condition.

Request you to assist on this.

Regards,
Shwetha

0 votes

Comments

 Does the script run? Do you see anything in the log files? 

Thanks for the reply Ralph.

I am printing severity and priority values and am getting the values. other than that am not getting any issues.

When i change the mandatory field from priority to any other integer value...i get the asterisk mark and also the error message "Attribute " some test" not set".

why is this like this ?



3 answers

Permanent link

 I have successfully used conditions with making enumeration attributes mandatory. So it is likely an issue with the JavaScript or a weird problem with your process which would require support to look at it.


Note, if you change attribute customization close all test work items and open them again to see any behavioral changes. In the Web UI use CTRL+F5 to refresh the browser in addition.

1 vote

Comments

Thanks for the reply Ralph.

I dont find any issue with the script. :(
What is the problem with the process you mentioned, how can I correct it ?

I tried all  things, and refreshing the browser as well and checked in other browser as well but no luck.

Please assist me on this.


Permanent link

Shwetha,
looking at yout script, it seems that it returns true only in one particular case:

  • the severity is either l5 or l6
  • and
  • the priority is l1

In all other cases, it returns false

That means that any attribute associated with this script will not be mandatory in all other cases; so, if the priority is not l1, it will not be mandatory.

Is this really the behavior you want to implement?

If your goal is set the Priority mandatory according to the value of the Severity, why do you put the value of the Priority in the "if" condition?

1 vote

Comments

Hi Luca,

Thanks for your reply. priority l1 is unassigned.

So am checking if the severity is "Crictical or blocker" and Priority is "Unassigned" then return true.

Am getting the asterisk, mean the script is fine....but on Save error message is not displayed.and not blocking the user to save.

Request you to assist on this.






Shwetha,
remove the (priority == "priority.literal.l1") from the if statement.
Then, enable this script-based condition for the Priority attribute.
Also, remember to activate the "Required attribute for condition" precondition in the process customization.

Luca, thanks for your quick response.

I tried removing the priority form the script. Also in the beginning only i have configured the pre-condition  "Required attribute for condition" and selected the priority attribute in the pop -up.

I didnt understand this : Then, enable this script-based condition for the Priority attribute.
What are the steps for doing this ?



 

Shwetha,
select the Priority attribute and click Edit: the properties window of the attribute will be displayed.
Then, select your script-based condition from the Conditions drop-down list.
And also, remember to add the Severity to the list of Dependencies (in the same properties window).

Luca, Thanks again. I cant select the condition script for the priority attribute,  as it is "Read Only"  field.

i have added the image as well.

Luca, I think the condition is always disabled, as i mentioned. Script based conditions should only be configured in pre-conditions. But the issue was different as mentioned below and i fixed it :)

I am happy that you solved the issue.
I remembered (wrongly) that the script-based conditions had to be enabled on each attribute for which that had been developed.
Actually, in your case, the problem was different.

showing 5 of 8 show 3 more comments

Permanent link

Hello Ralph and Luca,

I found where the issue was :)

I tired the same script for other enumeration value, it worked fine....

Then i checked the enumeration of the "Priority"..there the "Unassigned Literal" value was "None", for other enumerations, the value was "Unassigned".

When i set this value to the priority, it worked :)

What is the need for setting this "Unassigned Literal" value ?

0 votes

Comments

When an attribute is mandatory, and its value is "Unassigned", the work item save fails, so you have to select a different value.
Actually the Unassigned Literal is the literal that "tells" RTC that the attribute has not a "real" value associated.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Apr 11 '17, 1:08 a.m.

Question was seen: 3,320 times

Last updated: Apr 11 '17, 6:30 a.m.

Confirmation Cancel Confirm