It's all about the answers!

Ask a question

How do I make a work item attribute/field only visible upon the specific selection of another attribute's choice?


Mark Meiller (113) | asked Jun 04 '19, 7:33 p.m.
edited Jun 06 '19, 8:11 p.m.

Hello,

I am currently running Jazz Team Server v6.0.3, with intentions to upgrade to v6.0.6.1 .

I have a new business requirement and need to implement a custom created attribute called "Estimated Completion Date:" which is only visible upon the selection of a specific Team from the out of the box attribute "Filed Against:" choices.

Use case example:
If I create a work item and select the "Data" Team from the "Filed Against:" dropdown's choices, the custom attribute/field "Estimated Completion Date:" becomes visible and a date can be selected.  If I select any other Team from the "Filed Against:" dropdown's choices, the "Estimated Completion Date:" attribute/field is not visible/becomes hidden.  For reference if needed, the 'Estimated Completion Date' attribute type = Timestamp, and the 'Filed Against' type = Category.

I have read that there is Work Item Customization with JavaScript that could possibly give me this ability/feature.  Would anyone know how to implement this with JavaScript?

Thank you for any help.
Mark

3 answers



permanent link
Luca Martinucci (1.0k294112) | answered Jun 07 '19, 8:40 a.m.

In RTC you can hide or show an attribute on a form based on the presence of a link on the work item.

This is the rule: attributeA can be configured to show on the form only if the work item has at least one link of certain type (say, linkA)
With RTC 6.0.3 I had once your same need, and I achieved this goal by defining a set of custom link types (one for each "Filed Against" category).
Then I developed a follow-up action (triggered by work item save) that creates automatically on the work item a link of the type corresponding to the category.
When another category is selected, the old link is removed and a new one is created.
Anyway, you cannot implement this solution with JavaScript, you need server-side Java API.


Comments
Mark Meiller commented Jun 10 '19, 5:08 p.m.

Thank you Luca for looking at my question and answering.  I am definitely interested in this option.  I'm not sure I fully understand how to set this up or if this link would create confusion among my users as to what it is if they didn't understand the purpose, but I will test things out in my development environment and try to understand how your solution works.


Is there a specific place where custom link types are defined in the admin area?  Also, what happens when you click on the link that is created automatically - does it link to itself?  This answer I'm sure will get flushed out in me playing around with this in my sandbox instance if I can figure it out, but initially I'm having a hard time visualizing what the link would look like and what the link 's action would be when clicked on?

Thanks again,
Mark


Luca Martinucci commented Jun 12 '19, 5:07 a.m.

This page explains how to create a custom link type:

Concerning  what happens when you click the link, remember that a link typically associates a work item to another work item (but, of course, you can also link a work item to something different, like a requirement), so I suggest that you create a "placeholder" custom record (with no other purpose than making the custom link usable) for each custom link type, and that you link the original work item to the placeholder work item by means of the custom link; when you click it, RTC will open the placeholder work  item.


Luca Martinucci commented Jun 17 '19, 6:18 a.m.

If I remember correctly (I made such a customization a few years ago, with version 6.0.3), there is a property on the attribute presentation where you can specify that behavior.

The property is named "Hide if no links exists", and it is a drop-down list containing the names of different link types available on that work item.


Ralph Schoon commented Jun 17 '19, 8:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Yes, this is one of the very few options to hide an attribute. It only hides in the editor presentation as far as I am aware. 


permanent link
Ralph Schoon (63.1k33645) | answered Jun 07 '19, 2:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 07 '19, 2:29 a.m.

As far as I am aware there are no fancy ways allowing to hide attribute presentations. It is only possible to hide attributes based on the configuration options in the editor presentation. I am not aware of a dynamic way and there is also no API that I would be aware of.


In addition to all that, hiding the attributes in the editor presentation would not hide it in
  1. Query results
  2. Reports
  3. Plans


Comments
Mark Meiller commented Jun 10 '19, 4:49 p.m.

Copy that. Thank you Ralph for answering my question.


permanent link
Davyd Norris (2.2k217) | answered Jun 04 '19, 7:52 p.m.
There is a school of thought in uX design that says in this situation it's better not to hide and show individual fields and instead to make them read only. That's a very simple option that can be done out of the box.

Is there a reason you need the data to actually be hidden for some teams and not others?

Comments
Mark Meiller commented Jun 06 '19, 6:53 p.m.
Hi Davyd,
Thank you for your reply.

For the read-only option, is the below definition correct in my understanding of how that option works?

Read Only:  The associated attribute is defined one time only, and once it is then defined in the work item it cannot be changed further, but remains readable.

If this is correct or close to correct, it will not work for me.  I need the data to actually be hidden for some teams and not others because specific Teams have unique requirements for their work items, and if these requirements/fields are shown for the Teams that do not have said requirement, it will unfortunately cause confusion.

I appreciate your suggestion.

If you or anyone happen to know how I can implement the solution per my original question, I would appreciate it.

Thanks,
Mark 

Davyd Norris commented Jun 06 '19, 7:35 p.m.
That's sort of correct - you can make the field dynamically writeable based on all sorts of conditions, memberships and team permissions, but no you can't make it invisible based on other attributes, only by state.

The other problem is that even if you could, the attribute will only be hidden on the forms, it will always be there in the work item content when you build queries and reports.

If you only want specific teams to be able to use and see the information, the best approach is to duplicate the work item and then customise it for the team. You will then be able to control visibility of the work item type by permissions, but still show both types in a single report if people have permission to see both.

Mark Meiller commented Jun 06 '19, 8:05 p.m.

Thanks again for your reply Davyd.  Having the attribute only be hidden on the forms is exactly what I would need. If it shows in queries and reports that is not a concern because my users won't go that far with it.


Creating the custom work items is a good point, it's something I will most likely implement at a later date, but as things are just getting off the ground for us I would prefer to be able to keep it simple with out of the box work items that all can see and simply have the ability to hide a field or fields based on the Team selection.

I have read that there is Work Item Customization with JavaScript that could possibly give me this feature.  Would you or anyone else out there happen to know how to implement this with JavaScript?

Thanks,
Mark


Davyd Norris commented Jun 06 '19, 8:17 p.m.
I already had a look at this for you and unfortunately it's not possible as far as I can see. The API (even the undocumented stuff) gives you access to the work item itself, but you need access to the presentation.

I think your only option is to create a separate work item

Mark Meiller commented Jun 10 '19, 4:46 p.m.

Ok. Thank you Davyd for your time and help on this. 

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.