It's all about the answers!

Ask a question

work item attibute customization: make editable field after retrieving calculated value


Milan Krivic (9808161132) | asked Sep 02 '13, 7:42 a.m.
edited Sep 02 '13, 7:42 a.m.
 Hi,

I have a situation where I must pick up some attribute value and put it in WI summary.
I got it to work, but now I must make WI summary available for further editing (adding some additional text).

For example, I have custom attribute version with some value: 10.10.122
When I enter it, my WI summary must pick that value and leave it for further editing (example: v10.10.122_snap22).

As it is set that WI Summary use Calculated Value, every time when I want to change WI summary calculated value, on saving it returns origin calculated value.

I hope that my question is understandable. 

regards,

Accepted answer


permanent link
Ralph Schoon (58.0k23642) | answered Sep 02 '13, 8:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Milan,

the only thing that comes into mind is to try to return the current value of the attribute in the calculated attribute.
Calculated attributes always run based on their dependent attributes. There is no 'semi-calculated' value. Therefore there is no real solution for this case, I would be aware of. Usually you should use a default value for what you are trying, but there are only very few attributes available when the default value runs.

You can try if you can detect when the calculation should run or just return the current value. If you can't do that in JavaScript, you could try in Java. See: https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/
Milan Krivic selected this answer as the correct answer

Comments
Milan Krivic commented Sep 04 '13, 2:59 a.m. | edited Sep 04 '13, 3:05 a.m.

 Hi Ralph, 


just to inform you that I succeeded  to get what I want.
So the point was that in certain work item state I must pick up some other work item attribute value and leave it for further editing.
So, somewhere in the middle of my JavaScript code, I put this:

var other_value = workItem.getValue("com.apisit.release.app.version");
var type = workItem.getValue(WorkItemAttributes.TYPE);
var summary = workItem.getValue(WorkItemAttributes.SUMMARY);
var status = workItem.getValue(WorkItemAttributes.STATE);
if(type == "release_note" && status == "com.apisit.release.workflow.state.s3"){ //some work item type in some state
return other_value;
}
else
{
return summary;
}
Now, I am able in other WI state change this value (I mean add some text).

Thanks and Regards,
Milan


Ralph Schoon commented Sep 04 '13, 3:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Which is kind of what I suggested. Please accept the answer.

Your answer


Register or to post your answer.