It's all about the answers!

Ask a question

Read-Only and Required Attribute based on Action.


Yoshihisa Komai (3002422) | asked Feb 25 '13, 2:54 a.m.
I want to configure Read-Only and Required Attribute based on Action.


e.g
The state of a work item is now "In Progress".
If you choose "Complete" action, attribute A is Read-Only and attribute B is Required.
If you choose "Stop Working" action, attribute C is Required.

Is it possible?
I looked at following documents, but I was not able to figure it out.

https://jazz.net/library/article/997#dyncondition
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Conditions

2 answers



permanent link
Ralph Schoon (63.1k33646) | answered Feb 25 '13, 4:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Feb 25 '13, 6:40 a.m.
Hi, in RTC 4.x you can control read only and required attributes using operational behavior in the Process configuration>Team Configuration>Operational Behavior. The screen shot below shows the ones you are looking for. The ones that say "... For Condition" can be used together with JavaScript conditions to provide even more flexibility.








Comments
ken shounaga commented Feb 25 '13, 6:30 a.m.

Hi Ralph
I'm also interested in this topic.
Looking at the documents provided, I don't think this is possible.
https://jazz.net/library/article/997#dyncondition
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Conditions


It can be configured based on work item attribute.
e.g. It can be configured based on "State", "Severity" or etc.

But how can it be configured based on "Action"?
Can you let me know how the value of "Action" can be gotten by workItem.getValue?


Ralph Schoon commented Feb 25 '13, 6:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi, in RTC 4.x you have at least the ability to make attributes Read-Only or Required for a state. That was, I believe, what the question was about. The work item does not show while the state changes, so you can tie it only to the state.

The preconditions "Read-Only Attribute for Condition" and "Read-Only Attribute for Condition" can be used in conjunction with JavaScript. The JavaScript condition can access work item attribute data and return true or false in order to make attributes required or read-only. See https://jazz.net/library/article/1093 lab 5 for more information about scripting. I think it also shows an example how JavaScript and operational behavior work together.


Ralph Schoon commented Feb 25 '13, 6:46 a.m. | edited Feb 25 '13, 6:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I should add, the Enactment Workshop mentioned above shows how you can access the state of a work item. You can not access the workflow action that triggered the state change in JavaScript. You can also not access the previous state of the work item, neither do you have access to the interfaces that provide you with the workflow itself. This has been discussed several times in this forum. You might want to search for the questions that discuss it.

What you can do: With only the state attribute as dependent attribute you have some limited capability to detect a state changed. If you have more dependencies to other attributes you can only detect the current state and the values of the attributes, but not what changed in JavaScript.


ken shounaga commented Feb 25 '13, 7:23 a.m.

Hi Ralph,
Thank you for your answer.
I guess I understood your answer, but let me make it clear.
My concern is "Is it possible to configure Read-Only and Required Attribute based on Action?".

Is the answer "No, it is not possible"?(Because "You can not access the workflow action that triggered the state change in JavaScript.")


1
Ralph Schoon commented Feb 25 '13, 7:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

No, as far as I can tell you can not do what you request on a action for the reasons above.


Ralph Schoon commented Feb 25 '13, 7:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

And, to be honest, I don't understand why the action should be the element to look at. Would you have different read-only attributes for the same state if you got there on a different way? That would be very confusing.


ken shounaga commented Feb 25 '13, 7:59 a.m.

Hi Ralph,
Thank you very much for your answer :)

showing 5 of 7 show 2 more comments

permanent link
Tanya Scheffler (11) | answered Aug 11 '14, 1:47 p.m.
Hi Ralph,

I just wanted to comment on the scenario where this would make sense... and see if you have a work around.

I have added a bunch of attributes via "Required Attributes for Type and State" for State B.
When my work item goes from State A to State B, the user is required to fill in these attributes.

I also have an attribute that becomes read only (let's call it attribute Y), if attribute X is set.
I would like Y to be required when moving from State A to State B, if attribute X is not set, but not required if attribute X is set.

Essentially, my requirement is a mix of "Required Attributes for Type and State" and "Required Attributes for Condition".  However, due to the reasons you mentioned above, I can not combine these two behaviours.  That is, I can only read the State after the work item has made it to State B... and I don't want to make these attributes required in State A.

Any Ideas?

Comments
Ralph Schoon commented Aug 12 '14, 1:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can try a JavaScript condition. as mentioned in one of the comments above.

https://jazz.net/wiki/bin/view/Main/AttributeCustomization provides the selected action in the API for conditions and you can use the required for condition precondition with that I suppose.


Tanya Scheffler commented Aug 12 '14, 9:44 a.m.

I figured out a workaround... though it is not perfect.  I used one of the attributes that was required (via Required Attributes for Type and State) and I used it as a condition in my javascript code.  That is, if requiredAttribute is set and attribute X is not set, then Y is required, etc...

Of course, it means that the requiredAttribute must be set for this to work... so it's not perfect, but not bad either. ;-)

Your answer


Register or 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.