It's all about the answers!

Ask a question

How To Set Attributes as "Read-Only" Based Only on State

Rob Olsen (3511852) | asked Apr 26 '17, 12:53 p.m.

The other day I submitted a question to the Forum about how to make an attribute "read-only" based on a State.  I was provided with a great answer about using the "Operation Behavior" options and select "Read-Only Attributes for Type and State".  I thought this was my answer an went and implemented it, but it is not working correctly.  So I am either not implementing this right, or I need another solution.

I have a new Work Item called "Create PR" which has basically just two states (I know, but that is what the customer wants).  There is the "Initialization" and the "Defined" state.  "Create PR" is accessible from the RQM side via the Defects->Create Defect icon.  The menu will pop up and pre-populated with some info and should allow the user to then enter the rest.  When the "OK" button is pressed, a "PR" is created and supposed to be "read-only" from RTC now that it is in the "Defined" state.  Problem is, when I use the "Read-Only Attributes for Type and State" option, all of the attributes appear as "read-only" even in the "Initialization" state, so the user cannot enter anything.  This is true from both the RQM Create PR option and the Create PR option in the RTC drop down menu.  When I read the IBM documentation about "Read-Only Attributes for Type and State" it reads "Verifies that a work item that matches the selected types or states can be saved only if the selected attributes are unchanged.".  It states "types or states", so either I am not using this option correctly or this option does not provide the capability I am looking for.

Any help here is appreciated. 

One answer

permanent link
Ralph Schoon (63.1k33646) | answered Apr 26 '17, 2:39 p.m.
edited Apr 26 '17, 2:46 p.m.

My thoughts:

If the work item once saved is in the "Defined" then your work item actually has only one state - the temporary state when it is not initially saved is not a state, since the state of the work item will be "Defined"once it is saved. Thus the operation behavior assumes that the work item is already in that state and prevents saving.

You would need a real state like "Initialized" thet the work item has once initially saved. Then the operation behavior would work - once someone has actually selected a state change, they could no longer change the attributes.

I think you would need a cutom advisor the way I think your process is customited. Maybe a condition would work, because the condition does not know the state after the save. Not sure if a condition works across the tools.

Rob Olsen commented Apr 26 '17, 3:02 p.m.

Thanks Ralph.  What you stated makes sense because it does appear that the attributes are not really in any initial state when they are displayed for the first time.  The greyed out state says "uninitialized".  So I implemented two states.  "Initialized" and "Defined" and have a "Move to Initialized" and a"Move to "Defined" action.  In the "Read-Only Attributes for Type and State" operation I set all of the attributes to be read-only in the "Defined" state.  So actions would move me from "initial non-state or uninitialized" -> "Initialized"->"Defined".  But even in this case the attributes all appear to be "read-only" when they first come up in the "uninitialized" initial state.  It almost appears that the "read-only" is set on the attribute if the attribute even shows up and is not dependent on the state at all. 

I will continue to look at this, but your help is appreciated.

Rob Olsen commented Apr 26 '17, 3:23 p.m.

So I did some more checking and "Prevent Editing" seems to provide the capability that I am looking for.  I would rather be able to use the "read-only" feature, but that just does not seem to work.  So now I only have one state, "Defined".  This is set when the user selects "Save" or "OK".  If you jump over to where the record is created (RTC) the attributes still look like they are editable but when you update them and then click "Save", you get the error message "This work item must not be changed".  So its not as "nice" but it does work.  I can implement a message on the screen in the "Defined" state that says "All attributes are locked and cannot be changed".


Ralph Schoon commented Apr 27 '17, 2:44 a.m.

If prevent editing works for you, use it.

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.