How to get a RTC attribute original Value in Calculated Values javascript
Hello All,
I want to add a text log field B to log the value of Field A. That is the current value of Field A + original value of Field B.
How can I get the original value of Field B?
Also I want get the current state of the work item, tried a few ways, it did not work.
Your help would be greatly appreciated.
Jay Cheng
2 answers
the calculated value script looks like this
dojo.provide("com.example.ValueProvider");
(function() {
dojo.declare("com.example.ValueProvider", null, {
getValue: function(attribute, workItem, configuration) {
return workItem.getValue(attribute-ID);
}
});
})();
so, if you want some other attributes value you would
workItem.getValue(attribute-ID);
note this is NOT the 'name' of the attribute, but its ID..
dojo.provide("com.example.ValueProvider");
(function() {
dojo.declare("com.example.ValueProvider", null, {
getValue: function(attribute, workItem, configuration) {
return workItem.getValue(attribute-ID);
}
});
})();
so, if you want some other attributes value you would
workItem.getValue(attribute-ID);
note this is NOT the 'name' of the attribute, but its ID..
Based on previous discussions, you can't do it that way.
https://jazz.net/forum/questions/121485/can-i-get-the-previous-value-of-an-attribute-during-a-validator
https://jazz.net/forum/questions/148607/where-can-i-find-the-example-that-get-a-attributes-previous-value-and-current-value-on-the-workitem
If you have to do it using JavaScript, you may consider adding a hidden attribute containing the history of the attribute of interest.
https://jazz.net/forum/questions/121485/can-i-get-the-previous-value-of-an-attribute-during-a-validator
https://jazz.net/forum/questions/148607/where-can-i-find-the-example-that-get-a-attributes-previous-value-and-current-value-on-the-workitem
If you have to do it using JavaScript, you may consider adding a hidden attribute containing the history of the attribute of interest.