Calculated value script not returning the value.
Hi,
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.
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
You want to carefully read the documentation I sent you and understand the different types of attribute customization scripts and what you can access and what you can't.
Some more hints here:
https://jazz.net/library/article/1003
https://jazz.net/wiki/bin/view/Main/AttributeCustomization
https://rsjazz.wordpress.com/2016/07/15/rtc-process-customization-what-you-can-and-cannot-do/
You can not easily determine a state change in an attribute customization and you can not access links either. In order to do things like that you have to create a Java work item save advisor like https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/
Comments
2 other answers
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
You might want to look into this workshop: https://jazz.net/library/article/1093 especially https://jazz.net/library/content/articles/clm/2012/process-enactment-workshop/workbook/pew-rtc-lab-workbook.pdf . We have not done an example for an int but I would suggest to read it anyway. Also http://www.w3schools.com/ is a good first reference.
I'd try
var result = parseInt("35");
return result.