It's all about the answers!

Ask a question

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


prabhu Rao (115) | asked Sep 12 '17, 2:53 a.m.

Hi All, I need to have a script based condition where the String attribute (DevOps Number) should become mandate when the other Enumeration attribute (Project Type) is "Agile". I am able to get the asterisk mark for the DevOps Number, when I select the Project Type as Agile, But when I save the workitem am not getting any error messages saying "Attribute "DevOps Number" not set". Why conditions are not working for Enum to string type ? Following is the code : dojo.provide("test.DevOpsMandatory"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("test.DevOpsMandatory", null, { matches: function(workItem, configuration) { var projStat = workItem.getValue('projectStatus'); if(projStat=="ProjectStatus.literal.l3"){ return false; } else { return true; } } }); })(); Also i have configured this script in pre-condition. Request you to assist on this. Regards, Prabhu


Comments
prabhu Rao commented Sep 12 '17, 6:21 a.m.

The pre-condition describes that 'Verifies that a work item that matches a condition can only be saved if the selected attributes are different from the default value'.

Then how to set the default value for the string type attribute or Integer attribute?

One answer



permanent link
Donald Nong (14.4k314) | answered Sep 13 '17, 11:48 p.m.

If you get the asterisk mark, chances are your code works just find. The problem is with the pre-condition. You should use Required Attributes for Condition.
https://jazz.net/help-dev/clm/topic/com.ibm.team.workitem.doc/topics/t_configuring_dynamic_required_attributes.html

Your answer


Register or to post your answer.