Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Calculated Value script unable to update attribute value, when attribute is untouched.

I have a problem with the Calculated Value script setting value to an attribute. The problem is that the script does not change the value of the attribute when saving/changing a Work Item IF the attribute has not been written in (manually) before.
   It does however get the updated values if the whole page is refreshed but it does not get any new values after that. If I just write an empty space in the attribute field then the script starts working and updating the values correctly.

I have tested changing the attribute types to an enumeration instead of text but the same problem remains.

The goal of the script is to notice when a Work Item leaves a specific state, in this case a field needs to be cleared. So the script is saving the "previous state" when a Work Item changes states, and another script clears the field if the previous state is one of the chosen triggers. 

If there is any way to solve the original problem or a way to complete the goal in another way I would be very grateful!

Thanks in advance.

0 votes


Accepted answer

Permanent link
This is now solved.

The problem was that the Work Items where not synched. I had to perform a mass synchronization on all of the affected Work Items but then it worked as indended!
Ralph Schoon selected this answer as the correct answer

0 votes


One other answer

Permanent link
See https://jazz.net/wiki/bin/view/Main/AttributeCustomization for when scripts are supposed to be triggered. That happens for example if, in the UI, a dependent attribute changes.
The scripts can not detect a state changes. The Action is only available in conditions, so you would need at least one calculated, hidden, attribute to store the last state to be able to detect the new state.

0 votes

Comments

I have checked that link and there is not a problem with the triggering since 

"When a work item is saved, the script is executed to recalculate the value."

I have a two hidden fields, calculating the previous state when a Work Item is saved. These scripts work if I create a new Work Item. They do not work on previously created Work Items unless I write something in the fields manually once. After that they start responding to the scripts.

It seems that the fields are not registered in some way until they are changed.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,121

Question asked: Nov 12 '15, 4:40 a.m.

Question was seen: 2,399 times

Last updated: Nov 16 '15, 2:50 a.m.

Confirmation Cancel Confirm