Calculated value script not returning the value.
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
I have this dojo script, when i am jst trying to return a hardcoded value 35. but am not able to get the value to the attribute.
here the attribute is : Tracks of type integer. I always get the default value filled as zero.
dojo.provide("com.example.trackLink.formal");
(function() {
dojo.declare("com.example.trackLink.formal", null, {
getValue: function(attribute, workItem, configuration) {
return 35;
}
});
})();
Could you please help me this.
Thanks in advance.
Accepted answer
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
Comments
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
Some additional things:
Attribute customization execution rules are described in https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Calculated_values in the customization types. section.
You can not compute on load page.
You can not trigger on state change. I have seen some work around where users stored the state in hidden attributes. Please don't.
Read the limitations in the API in the link above. You have no real access to complex data or links. The best you can get for complex items is a Label or other representation.
2 other answers
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
Your script works fine.
Go to the Attribute definition and make sure that:
- The attribute type is Integer
- You have selected the script in the 'Calculated Value' column.
Comments
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
@Miguel Tomico, I had set the attribute's type to integer and also set the calculated script, but still it didnt work.
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
@Ralph Schoon, thanks for sharing the links, this is very helpful for me as a beginner.
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
I also need your support for my following queries.. Please help me :)
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
Comments
![](http://jazz.net/_images/myphoto/f9f5bf06805d009722a9de2149a12f64.jpg)
Hello Ralph,
I tried using above mentioned code, but no luck...however when i tried to add the dependency to the attribute, on changing the value of other attribute, this value is getting populated.
Is there any way that i can populate the value "35" on page load ? ITs only working when I have a dependency attribute value entered.
I have also set the Enable Process Attachment Scripts to true.