It's all about the answers!

Ask a question

How to restrict a value for a custom att of type WorkItem?

Stephan Gambke (134) | asked Aug 04 '22, 11:36 a.m.


I have created a custom attribute of type WorkItem.
When I click on choose value, a pop up comes to select a work item type.
I want to restrict it to select only 'Defect' as a type.
Is it possible?
Or can we validate that the selected workitem is of type Defect only?

Thanks in advance for all help.

Accepted answer

permanent link
Ralph Schoon (62.9k33645) | answered Aug 05 '22, 2:14 a.m.
edited Aug 05 '22, 2:15 a.m.

 The documented APIs do not allow attribute customization, to detect more complex information about complex items such as work items apart from the ID and the Item display name, for all I know. It is possible to use more internal and unsupported API to get this information if attribute customization is executed in the browser. This is discouraged and only works in the Web browser, not in the EWM Eclipse client.

It would be possible to use Java Based extensions (attribute customization or preconditions/advisors) to prevent saving with an incorrect value.

I would prefer if there was a mechanism to configure a query or filter for such attributes in the editor presentation to have better user support, but that would be an enhancement request. In the short term, I would look at an advisor/precondition. I have published examples on my blog:

Stephan Gambke selected this answer as the correct answer

Stephan Gambke commented Aug 05 '22, 3:25 a.m.

I'll look into that. Thanks!

One other answer

permanent link
Chidambaram L (2344074) | answered Aug 04 '22, 1:04 p.m.

Use Dojo scripting on the event of Change of another attr. If WorkItem is not Defect, pop up a message.

Or Use a Pre-Condition plug-in at save of work item. needs java development.
Refer for more information on Script based attributes in particular & Work Item Customization in General.

Your answer

Register or to post your answer.