It's all about the answers!

Ask a question

How to get a RTC attribute original Value in Calculated Values javascript


jay cheng (618) | asked Mar 11 '16, 9:48 a.m.

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



permanent link
sam detweiler (12.5k6189201) | answered Mar 12 '16, 11:11 a.m.
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..

Comments
jay cheng commented Apr 22 '16, 10:46 a.m.

workItem.getValue(attribute-ID get the current value, not the original value


permanent link
Donald Nong (14.4k314) | answered Apr 25 '16, 9:41 p.m.
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.

Your answer


Register or to post your answer.