condition values returning null
i am trying to make a text field mandatory when an option from drop down is selected.
but when i am executing the script it is returning null.
pls tell what we need to pass id or the attribute name
dropdown Attribute name : Sub Task details
ID :SubTaskdetails3
i have done the setting for operation behavior too but return value shows null.
pls help us in scripting this.
and in jaxx admin settings Enable Process Attachment Scripts is true.
Script:
dojo.provide("org.example.workitems.providers.testcasepreparation");
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.testcasepreparation", null, { matches: function(workItem, configuration) { var sev = workItem.getValue(WorkItemAttributes.SubTaskdetails3); debugger; alert (sev) return (sev === "dailytasksubcategory.literal.l1"); } }); })(); |
Accepted answer
>WorkItemAttributes.SubTaskdetails3
what is the TEXT ID of the attribute? WorktiemAttributes. only works for the pre-defined variables. all the others need the TEXT ID string.. I name my custom attributes something like "com.sd.tools.custom.attribute.defect.foo" so, when anyone looks at it, they know where it came from and where it is used. the string should be used where the 'WorkItemAttributes.SubTaskdetails3' value is.. workItem.getValue("com.sd.tools.custom.attribute.defect.foo"); kesav d selected this answer as the correct answer
|
One other answer
Ralph Schoon (63.5k●3●36●46)
| answered Aug 11 '16, 11:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Aug 11 '16, 11:59 a.m.
If you want to do this, you have to actually read the documentation available.
Those are https://jazz.net/wiki/bin/view/Main/AttributeCustomization and Lab 4 and 5 The built in attributes have constants as described in https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of WorkItemAttributes.SubTaskdetails3 is definitely not on the list and so you have to pass its ID as string. You can find the ID for attributes in the RTC Administration Web UI. So you would call like workItem.getValue("the.id.of.the.attribute.SubTaskdetails3"); Maybe workItem.getValue("SubTaskdetails3"); You use console.log as described in the links above and not alert. Also see https://rsjazz.wordpress.com/2016/06/17/javascript-attribute-customization-where-is-the-log-file/ Comments
Ralph Schoon
commented Aug 11 '16, 11:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I have already shared all these links above in other answers to your questions. If you are not willing to spend time reading these resources, my experience is, you will fail with attribute customization. You will basically hope and wait for others to fix your scripts, which will not work forever.
|
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.
Comments
thank u so much . it is working now