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

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"); 
    }
  });
})();

0 votes

Comments

 thank u so much . it is working now


Accepted answer

Permanent link
>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

0 votes


One other answer

Permanent link
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/

0 votes

Comments

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

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
× 10,954

Question asked: Aug 11 '16, 10:13 a.m.

Question was seen: 2,063 times

Last updated: Aug 12 '16, 12:08 a.m.

Confirmation Cancel Confirm