It's all about the answers!

Ask a question

Required attributes/attributes must have specific values on state transition


Lewis Tsao (2174458) | asked Apr 05 '13, 6:01 a.m.
edited Apr 05 '13, 6:19 a.m. by Ralph Schoon (60.9k33643)
Hi,

Not sure if something similar has been asked before.

Let's say I on a work item transition from stateA -> stateB, certain attributes are required and/or must have certain value. While it is in stateA, the attributes may or may not be set. But they must be set on transition.

So

stateA -> (precondition attribute set/specific value) action -> stateB
stateA -> action (precondition...) -> stateB

in stateA attr values don't care
in stateB attr values must be set/correct value
transition not permitted unless attr values must be set/correct value

can this be done (without Java/relatively easily)?

Thanks

Accepted answer


permanent link
Ralph Schoon (60.9k33643) | answered Apr 05 '13, 6:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Apr 05 '13, 6:20 a.m.
Levis, how that works with RTC is as follows.

You can configure required attributes in the Eclipse UI in the operation behavior section for the work item save operation. You can specify which attributes for which work items are required in which state. If a state change is selected the save will fail if these are not set.

You can use JavaScript attribute customization - validations - see https://jazz.net/wiki/bin/view/Main/AttributeCustomization and https://jazz.net/library/article/1093 to make sure that only certain values are valid to be saved in a specific state. However, the way JavaScript gets triggered it is currently not easily possible to detect a state change. So you would be probably able to have an attribute validation that looks at the current state and at an attribute value and select it invalid in this state, but you can not prevent a state change when the attribute value is valid in the current but not in the target state.

To achieve the latter, you would have to create a custom advisor / precondition, similar to the follow up action developed here: https://jazz.net/library/article/1000 . You can find additional information about advisors here: https://jazz.net/library/article/495 and hints about the API here in my blog.
Lewis Tsao selected this answer as the correct answer

Comments
Lewis Tsao commented Apr 05 '13, 6:41 a.m.

Many thanks Ralph.

Any chance of putting this in as an enhancement request. I have been to various customers who have requested this.

I suppose it is possible to work round this by having an "approver" who will only approve the WI when all "answers" are correct. But this can become tedious for the approver if there are lots of WI.


Ralph Schoon commented Apr 05 '13, 7:05 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Lewis, I think you should not have different valid values of attribute in different states - except more choices.

If I work on a work item and provide values that are correct and save, I would be fine with having additional attributes required.

But if a value was selected days ago and now I change the state and the value is no longer valid, I would personally reject the workflow. Someone put the value in there for a reason - I hope - and now the value is not supposed to be correct anymore? That does not make much sense to me in general cases.

If I change a value and now a dependent value is not valid any more, that is probably OK and doable today.

I have seen a several cases where features where requested that are unnecessary if you manage the process in a different way in the past. So I would be interested in the real use cases and the business value the customers have expressed. You can always request an enhancement here but be prepared to provide the use cases.

 


One other answer



permanent link
Lewis Tsao (2174458) | answered Apr 05 '13, 6:42 a.m.
Many thanks Ralph.

Any chance of putting this in as an enhancement request. I have been to various customers who have requested this.

I suppose it is possible to work round this by having an "approver" who will only approve the WI when all "answers" are correct. But this can become tedious for the approver if there are lots of WI.

Your answer


Register or to post your answer.